Исправлена проблема с регистром тега clipPath
Showing
| ... | @@ -2,12 +2,16 @@ | ... | @@ -2,12 +2,16 @@ |
| 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
|
|||
| this.lowerCaseTagNames = lowerCaseTagNames; | |||
| } | |||
| getFirstChild (node) { | |||
| return node.childNodes[0]; | return node.childNodes[0]; | ||
| }; | } | ||
| exports.getChildNodes = function (node) { | getChildNodes (node) { | ||
| // parse5 treats template elements specially, assuming you return an array whose single item is the document fragment | // parse5 treats template elements specially, assuming you return an array whose single item is the document fragment | ||
| const children = node._templateContents ? [node._templateContents] : []; | const children = node._templateContents ? [node._templateContents] : []; | ||
| if (children.length === 0) { | if (children.length === 0) { | ||
| ... | @@ -16,58 +20,61 @@ exports.getChildNodes = function (node) { | ... | @@ -16,58 +20,61 @@ exports.getChildNodes = function (node) { |
| } | } | ||
| } | } | ||
| 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 | // Node data | ||
| exports.getTagName = function (element) { | getTagName (element) { | ||
| return element.tagName.toLowerCase(); | return this.lowerCaseTagNames?element.tagName.toLowerCase():element.tagName; | ||
| }; | } | ||
| exports.getNamespaceURI = function (element) { | getNamespaceURI (element) { | ||
| return element.namespaceURI || "http://www.w3.org/1999/xhtml"; | return element.namespaceURI || "http://www.w3.org/1999/xhtml"; | ||
| }; | } | ||
| exports.getTextNodeContent = function (textNode) { | getTextNodeContent (textNode) { | ||
| return textNode.nodeValue; | return textNode.nodeValue; | ||
| }; | } | ||
| exports.getCommentNodeContent = function (commentNode) { | getCommentNodeContent (commentNode) { | ||
| return commentNode.nodeValue; | return commentNode.nodeValue; | ||
| }; | } | ||
| exports.getDocumentTypeNodeName = function (doctypeNode) { | getDocumentTypeNodeName (doctypeNode) { | ||
| return doctypeNode.name; | return doctypeNode.name; | ||
| }; | } | ||
| exports.getDocumentTypeNodePublicId = function (doctypeNode) { | getDocumentTypeNodePublicId (doctypeNode) { | ||
| return doctypeNode.publicId || null; | return doctypeNode.publicId || null; | ||
| }; | } | ||
| exports.getDocumentTypeNodeSystemId = function (doctypeNode) { | getDocumentTypeNodeSystemId (doctypeNode) { | ||
| return doctypeNode.systemId || null; | return doctypeNode.systemId || null; | ||
| }; | } | ||
| // Node types | // Node types | ||
| exports.isTextNode = function (node) { | isTextNode (node) { | ||
| return node.nodeName === "#text"; | return node.nodeName === "#text"; | ||
| }; | } | ||
| exports.isCommentNode = function (node) { | isCommentNode (node) { | ||
| return node.nodeName === "#comment"; | return node.nodeName === "#comment"; | ||
| }; | } | ||
| exports.isDocumentTypeNode = function (node) { | isDocumentTypeNode (node) { | ||
| return node.nodeType === 10; | return node.nodeType === 10; | ||
| }; | } | ||
| exports.isElementNode = function (node) { | isElementNode (node) { | ||
| return Boolean(node.tagName); | return Boolean(node.tagName); | ||
| }; | } | ||
| } | |||
| module.exports = DocumentAdapter; |