diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-02-25 15:07:00 -0500 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 12:55:19 +0200 |
commit | eb70e6e3d0bff11c25f14b1196025791bf2308fb (patch) | |
tree | 5ef4ce17db83c74d7b05ec12c8f59e095a6dd5bd /toolkit/components/microformats/test/lib/html.js | |
parent | 32ead795290b3399d56b4708fc75b77d296f6a1a (diff) | |
download | UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.gz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.lz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.xz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.zip |
Issue #439 - Remove tests from toolkit/
Diffstat (limited to 'toolkit/components/microformats/test/lib/html.js')
-rw-r--r-- | toolkit/components/microformats/test/lib/html.js | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/toolkit/components/microformats/test/lib/html.js b/toolkit/components/microformats/test/lib/html.js deleted file mode 100644 index ab150d91e..000000000 --- a/toolkit/components/microformats/test/lib/html.js +++ /dev/null @@ -1,107 +0,0 @@ -/* - html - Extracts a HTML string from DOM nodes. Was created to get around the issue of not being able to exclude the content - of nodes with the 'data-include' attribute. DO NOT replace with functions such as innerHTML as it will break a - number of microformat include patterns. - - Copyright (C) 2010 - 2015 Glenn Jones. All Rights Reserved. - MIT License: https://raw.github.com/glennjones/microformat-node/master/license.txt - Dependencies utilities.js, domutils.js -*/ - - -var Modules = (function (modules) { - - modules.html = { - - // elements which are self-closing - selfClosingElt: ['area', 'base', 'br', 'col', 'hr', 'img', 'input', 'link', 'meta', 'param', 'command', 'keygen', 'source'], - - - /** - * parse the html string from DOM Node - * - * @param {DOM Node} node - * @return {String} - */ - parse: function( node ){ - var out = '', - j = 0; - - // we do not want the outer container - if(node.childNodes && node.childNodes.length > 0){ - for (j = 0; j < node.childNodes.length; j++) { - var text = this.walkTreeForHtml( node.childNodes[j] ); - if(text !== undefined){ - out += text; - } - } - } - - return out; - }, - - - /** - * walks the DOM tree parsing the html string from the nodes - * - * @param {DOM Document} doc - * @param {DOM Node} node - * @return {String} - */ - walkTreeForHtml: function( node ) { - var out = '', - j = 0; - - // if node is a text node get its text - if(node.nodeType && node.nodeType === 3){ - out += modules.domUtils.getElementText( node ); - } - - - // exclude text which has been added with include pattern - - if(node.nodeType && node.nodeType === 1 && modules.domUtils.hasAttribute(node, 'data-include') === false){ - - // begin tag - out += '<' + node.tagName.toLowerCase(); - - // add attributes - var attrs = modules.domUtils.getOrderedAttributes(node); - for (j = 0; j < attrs.length; j++) { - out += ' ' + attrs[j].name + '=' + '"' + attrs[j].value + '"'; - } - - if(this.selfClosingElt.indexOf(node.tagName.toLowerCase()) === -1){ - out += '>'; - } - - // get the text of the child nodes - if(node.childNodes && node.childNodes.length > 0){ - - for (j = 0; j < node.childNodes.length; j++) { - var text = this.walkTreeForHtml( node.childNodes[j] ); - if(text !== undefined){ - out += text; - } - } - } - - // end tag - if(this.selfClosingElt.indexOf(node.tagName.toLowerCase()) > -1){ - out += ' />'; - }else{ - out += '</' + node.tagName.toLowerCase() + '>'; - } - } - - return (out === '')? undefined : out; - } - - - }; - - - return modules; - -} (Modules || {})); - |