Исправлена проблема с регистром тега clipPath
Showing
| ... | @@ -2,72 +2,79 @@ | ... | @@ -2,72 +2,79 @@ |
| const idlUtils = require("../living/generated/utils"); | const idlUtils = require("../living/generated/utils"); | ||
| // Tree traversing | class DocumentAdapter { | ||
| exports.getFirstChild = function (node) { | constructor(lowerCaseTagNames){ | ||
Please
register
or
sign in
to reply
|
|||
| return node.childNodes[0]; | this.lowerCaseTagNames = lowerCaseTagNames; | ||
| }; | } | ||
| exports.getChildNodes = function (node) { | getFirstChild (node) { | ||
| // parse5 treats template elements specially, assuming you return an array whose single item is the document fragment | return node.childNodes[0]; | ||
| const children = node._templateContents ? [node._templateContents] : []; | } | ||
| if (children.length === 0) { | |||
| for (let i = 0; i < node.childNodes.length; ++i) { | getChildNodes (node) { | ||
| children.push(idlUtils.implForWrapper(node.childNodes[i])); | // parse5 treats template elements specially, assuming you return an array whose single item is the document fragment | ||
| const children = node._templateContents ? [node._templateContents] : []; | |||
| if (children.length === 0) { | |||
| for (let i = 0; i < node.childNodes.length; ++i) { | |||
| children.push(idlUtils.implForWrapper(node.childNodes[i])); | |||
| } | |||
| } | } | ||
| return children; | |||
| } | } | ||
| return children; | |||
| }; | |||
| exports.getParentNode = function (node) { | getParentNode (node) { | ||
| return node.parentNode; | return node.parentNode; | ||
| }; | } | ||
| exports.getAttrList = function (node) { | getAttrList (node) { | ||
| return node.attributes; | return node.attributes; | ||
| }; | } | ||
| // Node data | |||
| getTagName (element) { | |||
| return this.lowerCaseTagNames?element.tagName.toLowerCase():element.tagName; | |||
| } | |||
| // Node data | getNamespaceURI (element) { | ||
| exports.getTagName = function (element) { | return element.namespaceURI || "http://www.w3.org/1999/xhtml"; | ||
| return element.tagName.toLowerCase(); | } | ||
| }; | |||
| exports.getNamespaceURI = function (element) { | getTextNodeContent (textNode) { | ||
| return element.namespaceURI || "http://www.w3.org/1999/xhtml"; | return textNode.nodeValue; | ||
| }; | } | ||
| exports.getTextNodeContent = function (textNode) { | getCommentNodeContent (commentNode) { | ||
| return textNode.nodeValue; | return commentNode.nodeValue; | ||
| }; | } | ||
| exports.getCommentNodeContent = function (commentNode) { | getDocumentTypeNodeName (doctypeNode) { | ||
| return commentNode.nodeValue; | return doctypeNode.name; | ||
| }; | } | ||
| exports.getDocumentTypeNodeName = function (doctypeNode) { | getDocumentTypeNodePublicId (doctypeNode) { | ||
| return doctypeNode.name; | return doctypeNode.publicId || null; | ||
| }; | } | ||
| exports.getDocumentTypeNodePublicId = function (doctypeNode) { | getDocumentTypeNodeSystemId (doctypeNode) { | ||
| return doctypeNode.publicId || null; | return doctypeNode.systemId || null; | ||
| }; | } | ||
| exports.getDocumentTypeNodeSystemId = function (doctypeNode) { | // Node types | ||
| return doctypeNode.systemId || null; | isTextNode (node) { | ||
| }; | return node.nodeName === "#text"; | ||
| } | |||
| // Node types | isCommentNode (node) { | ||
| exports.isTextNode = function (node) { | return node.nodeName === "#comment"; | ||
| return node.nodeName === "#text"; | } | ||
| }; | |||
| exports.isCommentNode = function (node) { | isDocumentTypeNode (node) { | ||
| return node.nodeName === "#comment"; | return node.nodeType === 10; | ||
| }; | } | ||
| exports.isDocumentTypeNode = function (node) { | isElementNode (node) { | ||
| return node.nodeType === 10; | return Boolean(node.tagName); | ||
| }; | } | ||
| } | |||
| exports.isElementNode = function (node) { | module.exports = DocumentAdapter; | ||
| return Boolean(node.tagName); | |||
| }; |