MarkTraceur has uploaded a new change for review.
https://gerrit.wikimedia.org/r/57397
Change subject: Actually update domino
......................................................................
Actually update domino
My package.json was out of date.
Change-Id: I6607113e9d4f46fd88c38bf67bf0b9265bd6539b
---
M node_modules/domino/lib/Document.js
M node_modules/domino/lib/Node.js
M node_modules/domino/lib/htmlelts.js
M node_modules/domino/package.json
M node_modules/domino/test/domino.js
M package.json
6 files changed, 69 insertions(+), 7 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid/js/contrib
refs/changes/97/57397/1
diff --git a/node_modules/domino/lib/Document.js
b/node_modules/domino/lib/Document.js
index 481f928..aac404c 100644
--- a/node_modules/domino/lib/Document.js
+++ b/node_modules/domino/lib/Document.js
@@ -363,6 +363,10 @@
get: function() { return this.serialize(); },
set: utils.nyi
},
+ outerHTML: {
+ get: function() { return this.serialize(); },
+ set: utils.nyi
+ },
write: { value: function(args) {
if (!this.isHTML) utils.InvalidStateError();
diff --git a/node_modules/domino/lib/Node.js b/node_modules/domino/lib/Node.js
index 4978dc0..bbcfa79 100644
--- a/node_modules/domino/lib/Node.js
+++ b/node_modules/domino/lib/Node.js
@@ -543,9 +543,10 @@
s += '>';
if (!(html && emptyElements[tagname])) {
- if (html && extraNewLine[tagname]) s += '\n';
+ var ss = kid.serialize();
+ if (html && extraNewLine[tagname] && ss.charAt(0)==='\n') s += '\n';
// Serialize children and add end tag for all others
- s += kid.serialize();
+ s += ss;
s += '</' + tagname + '>';
}
break;
@@ -585,8 +586,22 @@
}
return s;
- }}
+ }},
+ // mirror node type properties in the prototype, so they are present
+ // in instances of Node (and subclasses)
+ ELEMENT_NODE: { value: ELEMENT_NODE },
+ ATTRIBUTE_NODE: { value: ATTRIBUTE_NODE },
+ TEXT_NODE: { value: TEXT_NODE },
+ CDATA_SECTION_NODE: { value: CDATA_SECTION_NODE },
+ ENTITY_REFERENCE_NODE: { value: ENTITY_REFERENCE_NODE },
+ ENTITY_NODE: { value: ENTITY_NODE },
+ PROCESSING_INSTRUCTION_NODE: { value: PROCESSING_INSTRUCTION_NODE },
+ COMMENT_NODE: { value: COMMENT_NODE },
+ DOCUMENT_NODE: { value: DOCUMENT_NODE },
+ DOCUMENT_TYPE_NODE: { value: DOCUMENT_TYPE_NODE },
+ DOCUMENT_FRAGMENT_NODE: { value: DOCUMENT_FRAGMENT_NODE },
+ NOTATION_NODE: { value: NOTATION_NODE }
});
function escape(s) {
diff --git a/node_modules/domino/lib/htmlelts.js
b/node_modules/domino/lib/htmlelts.js
index 0b88888..12be22d 100644
--- a/node_modules/domino/lib/htmlelts.js
+++ b/node_modules/domino/lib/htmlelts.js
@@ -112,6 +112,19 @@
Element.call(this, doc, localName, NAMESPACE.HTML, prefix);
},
props: {
+ outerHTML: {
+ get: function() {
+ // "the attribute must return the result of running the HTML fragment
+ // serialization algorithm on a fictional node whose only child is
+ // the context object"
+ var fictional = {
+ childNodes: [ this ],
+ nodeType: 0
+ };
+ return this.serialize.call(fictional);
+ },
+ set: utils.nyi
+ },
innerHTML: {
get: function() {
return this.serialize();
diff --git a/node_modules/domino/package.json b/node_modules/domino/package.json
index 0a8fb68..df33d18 100644
--- a/node_modules/domino/package.json
+++ b/node_modules/domino/package.json
@@ -1,6 +1,6 @@
{
"name": "domino",
- "version": "1.0.8",
+ "version": "1.0.9",
"author": {
"name": "Felix Gnass",
"email": "[email protected]"
@@ -21,6 +21,9 @@
},
"readme": "# Server-side DOM implementation based on Mozilla's
dom.js\n\n[](http://travis-ci.org/fgnass/domino)\n\nAs
the name might suggest, domino's goal is to provide a <b>DOM in
No</b>de.\n\nIn contrast to the original
[dom.js](https://github.com/andreasgal/dom.js) project, domino was not designed
to run untrusted code. Hence it doesn't have to hide its internals behind a
proxy facade which makes the code not only simpler, but also [more
performant](https://github.com/fgnass/dombench).\n\nDomino currently doesn't
use any harmony features like proxies or WeakMaps and therefore also runs in
older Node versions.\n\n## Speed over Compliance\n\nDomino is intended for
_building_ pages rather than scraping them. Hence Domino doesn't execute
scripts nor does it download external resources.\n\nAlso Domino doesn't
implement any properties which have been deprecated in HTML5.\n\nDomino sticks
to the [DOM level
4](http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-attr)
working draft, which means that Attributes do not inherit the Node interface.
Also
[Element.attributes](http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-element-attributes)
returns a read-only array instead of a NamedNodeMap.\n\n## CSS Selector
Support\n\nDomino provides support for `querySelector()` and
`querySelectorAll()` backed by the [Zest](https://github.com/chjj/zest)
selector engine.\n\n## Usage\n\n```javascript\nvar domino =
require('domino');\n\nvar window = domino.createWindow('<h1>Hello
world</h1>');\nvar document = window.document;\n\nvar h1 =
document.querySelector('h1');\nconsole.log(h1.innerHTML);\n```\n\n##
Tests\n\nDomino includes test from the [W3C DOM Conformance
Suites](http://www.w3.org/DOM/Test/)\nas well as tests from [HTML Working
Group](http://www.w3.org/html/wg/wiki/Testing).\n\nThe tests can be run via
`npm test` or directly though the [Mocha](http://visionmedia.github.com/mocha/)
command
line:\n\n\n\n##
License and Credits\n\nThe majority of the code was written by [Andreas
Gal](https://github.com/andreasgal/) and [David
Flanagan](https://github.com/davidflanagan) as part of the
[dom.js](https://github.com/andreasgal/dom.js) project. Please refer to the
included LICENSE file for the original copyright notice and disclaimer.\n",
"readmeFilename": "README.md",
- "_id": "[email protected]",
- "_from": "[email protected]"
+ "_id": "[email protected]",
+ "dist": {
+ "shasum": "a30fa31fdf9f6ef6e2034c0e88c981365667e79d"
+ },
+ "_from": "domino@~1.0.9"
}
diff --git a/node_modules/domino/test/domino.js
b/node_modules/domino/test/domino.js
index 330220b..e8e8bb6 100644
--- a/node_modules/domino/test/domino.js
+++ b/node_modules/domino/test/domino.js
@@ -117,3 +117,30 @@
root.lastChild.lastChild.firstChild
]);
}
+
+exports.innerHTML = function() {
+ var d = domino.createDocument();
+ ['pre','textarea','listing'].forEach(function(elementName) {
+ var div = d.createElement('div')
+ var el = d.createElement(elementName);
+ el.innerHTML = "a";
+ div.appendChild(el);
+ // no extraneous newline after element tag in this case
+ div.innerHTML.should.equal('<'+elementName+'>a</'+elementName+'>');
+ el.innerHTML = "\nb";
+ // first newline after element is swallowed. needs two.
+ div.innerHTML.should.equal('<'+elementName+'>\n\nb</'+elementName+'>');
+ });
+}
+
+exports.outerHTML = function() {
+ var tests = [
+ '<body><pre>\n\na\n</pre></body>',
+ '<body bgcolor="white"><h1 style="color: red">\nOne\n2 &
3</h1></body>',
+ '<body data-test="<>&"\'"></body>'
+ ];
+ tests.forEach(function(html) {
+ var d = domino.createDocument(html);
+ d.body.outerHTML.should.equal(html);
+ });
+}
diff --git a/package.json b/package.json
index 9c54845..953405f 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,7 @@
"jshashes": "1.x.x",
"optimist": "0.x.x",
"assert": "0.x.x",
- "domino": "1.0.8",
+ "domino": "~1.0.9",
"pegjs": "0.7.x",
"lru-cache": "1.x.x",
"async": "0.x.x",
--
To view, visit https://gerrit.wikimedia.org/r/57397
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6607113e9d4f46fd88c38bf67bf0b9265bd6539b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid/js/contrib
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits