diff options
author | Ascrod <32915892+Ascrod@users.noreply.github.com> | 2020-05-23 22:12:01 -0400 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-06-01 11:46:41 +0000 |
commit | 66470fa1d8df6e3b145e060aba0e7b2649a55129 (patch) | |
tree | 5432b8adda5e4f3c7147ebe83170541e709cdebb /toolkit/components/reader/JSDOMParser.js | |
parent | 3045e1d5c9805221ab9a28539286ba463f636210 (diff) | |
download | UXP-66470fa1d8df6e3b145e060aba0e7b2649a55129.tar UXP-66470fa1d8df6e3b145e060aba0e7b2649a55129.tar.gz UXP-66470fa1d8df6e3b145e060aba0e7b2649a55129.tar.lz UXP-66470fa1d8df6e3b145e060aba0e7b2649a55129.tar.xz UXP-66470fa1d8df6e3b145e060aba0e7b2649a55129.zip |
Issue #361 - Update Readability from upstream.
(git rev 52ab9b5c8916c306a47b2119270dcdabebf9d203)
Diffstat (limited to 'toolkit/components/reader/JSDOMParser.js')
-rw-r--r-- | toolkit/components/reader/JSDOMParser.js | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/toolkit/components/reader/JSDOMParser.js b/toolkit/components/reader/JSDOMParser.js index ab2f503e1..2d3d6f156 100644 --- a/toolkit/components/reader/JSDOMParser.js +++ b/toolkit/components/reader/JSDOMParser.js @@ -315,6 +315,7 @@ } } getElems(this); + elems._isLiveNodeList = true; return elems; } @@ -503,17 +504,9 @@ }, setValue: function(newValue) { this._value = newValue; - delete this._decodedValue; }, - setDecodedValue: function(newValue) { - this._value = encodeHTML(newValue); - this._decodedValue = newValue; - }, - getDecodedValue: function() { - if (typeof this._decodedValue === "undefined") { - this._decodedValue = (this._value && decodeHTML(this._value)) || ""; - } - return this._decodedValue; + getEncodedValue: function() { + return encodeHTML(this._value); }, }; @@ -673,6 +666,14 @@ this.setAttribute("src", str); }, + get srcset() { + return this.getAttribute("srcset") || ""; + }, + + set srcset(str) { + this.setAttribute("srcset", str); + }, + get nodeName() { return this.tagName; }, @@ -689,7 +690,7 @@ for (var j = 0; j < child.attributes.length; j++) { var attr = child.attributes[j]; // the attribute value will be HTML escaped. - var val = attr.value; + var val = attr.getEncodedValue(); var quote = (val.indexOf('"') === -1 ? '"' : "'"); arr.push(" " + attr.name + "=" + quote + val + quote); } @@ -767,8 +768,9 @@ getAttribute: function (name) { for (var i = this.attributes.length; --i >= 0;) { var attr = this.attributes[i]; - if (attr.name === name) - return attr.getDecodedValue(); + if (attr.name === name) { + return attr.value; + } } return undefined; }, @@ -777,11 +779,11 @@ for (var i = this.attributes.length; --i >= 0;) { var attr = this.attributes[i]; if (attr.name === name) { - attr.setDecodedValue(value); + attr.setValue(value); return; } } - this.attributes.push(new Attribute(name, encodeHTML(value))); + this.attributes.push(new Attribute(name, value)); }, removeAttribute: function (name) { @@ -945,7 +947,7 @@ // Read the attribute value (and consume the matching quote) var value = this.readString(c); - node.attributes.push(new Attribute(name, value)); + node.attributes.push(new Attribute(name, decodeHTML(value))); return; }, |