Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/aardvark.js

Issue 29361130: Issue 4588 - "View source" command doesn't show text nodes (Closed) Base URL: https://hg.adblockplus.org/elemhidehelper
Patch Set: Created Oct. 31, 2016, 9:39 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This Source Code is subject to the terms of the Mozilla Public License 2 * This Source Code is subject to the terms of the Mozilla Public License
3 * version 2.0 (the "License"). You can obtain a copy of the License at 3 * version 2.0 (the "License"). You can obtain a copy of the License at
4 * http://mozilla.org/MPL/2.0/. 4 * http://mozilla.org/MPL/2.0/.
5 */ 5 */
6 6
7 let {Services} = Cu.import("resource://gre/modules/Services.jsm", {}); 7 let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
8 8
9 let {Prefs} = require("prefs"); 9 let {Prefs} = require("prefs");
10 10
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 { 731 {
732 var type = null; 732 var type = null;
733 switch (node.nodeType) 733 switch (node.nodeType)
734 { 734 {
735 case node.ELEMENT_NODE: 735 case node.ELEMENT_NODE:
736 var box = this.window.document.createElement("vbox"); 736 var box = this.window.document.createElement("vbox");
737 box.className = "elementBox"; 737 box.className = "elementBox";
738 738
739 var startTag = this.window.document.createElement("hbox"); 739 var startTag = this.window.document.createElement("hbox");
740 startTag.className = "elementStartTag"; 740 startTag.className = "elementStartTag";
741 if (!node.firstElementChild) 741 if (!node.firstChild)
742 startTag.className += " elementEndTag"; 742 startTag.className += " elementEndTag";
743 743
744 this.appendDescription(startTag, "<", null); 744 this.appendDescription(startTag, "<", null);
745 this.appendDescription(startTag, node.tagName, "tagName"); 745 this.appendDescription(startTag, node.tagName, "tagName");
746 746
747 for (var i = 0; i < node.attributes.length; i++) 747 for (var i = 0; i < node.attributes.length; i++)
748 { 748 {
749 var attr = node.attributes[i]; 749 var attr = node.attributes[i];
750 this.appendDescription(startTag, attr.name, "attrName"); 750 this.appendDescription(startTag, attr.name, "attrName");
751 if (attr.value != "") 751 if (attr.value != "")
752 { 752 {
753 this.appendDescription(startTag, "=", null); 753 this.appendDescription(startTag, "=", null);
754 this.appendDescription(startTag, '"' + attr.value.replace(/"/, "&quo t;") + '"', "attrValue"); 754 this.appendDescription(startTag, '"' + attr.value.replace(/"/, "&quo t;") + '"', "attrValue");
755 } 755 }
756 } 756 }
757 757
758 this.appendDescription(startTag, node.firstElementChild ? ">" : " />", n ull); 758 this.appendDescription(startTag, node.firstChild ? ">" : " />", null);
759 box.appendChild(startTag); 759 box.appendChild(startTag);
760 760
761 if (node.firstElementChild) 761 if (node.firstChild)
762 { 762 {
763 for (var child = node.firstElementChild; child; child = child.nextElem entSibling) 763 for (var child = node.firstChild; child; child = child.nextSibling)
764 this.getOuterHtmlFormatted(child, box); 764 this.getOuterHtmlFormatted(child, box);
765 765
766 var endTag = this.window.document.createElement("hbox"); 766 var endTag = this.window.document.createElement("hbox");
767 endTag.className = "elementEndTag"; 767 endTag.className = "elementEndTag";
768 this.appendDescription(endTag, "<", null); 768 this.appendDescription(endTag, "<", null);
769 this.appendDescription(endTag, "/" + node.tagName, "tagName"); 769 this.appendDescription(endTag, "/" + node.tagName, "tagName");
770 this.appendDescription(endTag, ">", null); 770 this.appendDescription(endTag, ">", null);
771 box.appendChild(endTag); 771 box.appendChild(endTag);
772 } 772 }
773 container.appendChild(box); 773 container.appendChild(box);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 // Show help box 819 // Show help box
820 helpBox.showPopup(this.browser, -1, -1, "tooltip", "topleft", "topleft"); 820 helpBox.showPopup(this.browser, -1, -1, "tooltip", "topleft", "topleft");
821 return true; 821 return true;
822 } 822 }
823 } 823 }
824 824
825 // Makes sure event handlers like Aardvark.onKeyPress always have the correct 825 // Makes sure event handlers like Aardvark.onKeyPress always have the correct
826 // this pointer set. 826 // this pointer set.
827 for (let method of ["onMouseClick", "onMouseScroll", "onKeyPress", "onPageHide", "onMouseMove", "onAfterPaint", "quit"]) 827 for (let method of ["onMouseClick", "onMouseScroll", "onKeyPress", "onPageHide", "onMouseMove", "onAfterPaint", "quit"])
828 Aardvark[method] = Aardvark[method].bind(Aardvark); 828 Aardvark[method] = Aardvark[method].bind(Aardvark);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld