Reviewed by Adam Roben.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 24 Nov 2007 22:35:52 +0000 (22:35 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 24 Nov 2007 22:35:52 +0000 (22:35 +0000)
        Bug 16121: Web Inspector needs helper functions that pass a 'this' object to
        addEventListener and setTimeout
        http://bugs.webkit.org/show_bug.cgi?id=16121

        Add Function.prototype.bind. This helper will return a wrapper function
        that will call the original function with the supplied arguments
        and using the supplied 'this' object.

        * page/inspector/Database.js: Remove a use of setTimeout by
          inheriting some common functions from Resource.
        * page/inspector/DatabasePanel.js: Use the new bind function.
        * page/inspector/ConsolePanel.js: Ditto.
        * page/inspector/DocumentPanel.js: Ditto.
        * page/inspector/NetworkPanel.js: Ditto.
        * page/inspector/PropertiesSection.js: Ditto.
        * page/inspector/Resource.js: Ditto.
        * page/inspector/SidebarPane.js: Ditto.
        * page/inspector/inspector.html: Moved Database.js after Resource.js,
          now that Database.js uses it.
        * page/inspector/inspector.js: Use the new bind function. Also
          removed a setTimeout used for the localized strings code. There is
          now a load event listener added to the localized strings script
          element that will call WebInspector.loaded.
        * page/inspector/utilities.js: Add Function.prototype.bind.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28002 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
WebCore/ChangeLog
WebCore/page/inspector/ConsolePanel.js
WebCore/page/inspector/Database.js
WebCore/page/inspector/DatabasePanel.js
WebCore/page/inspector/DocumentPanel.js
WebCore/page/inspector/NetworkPanel.js
WebCore/page/inspector/PropertiesSection.js
WebCore/page/inspector/Resource.js
WebCore/page/inspector/SidebarPane.js
WebCore/page/inspector/inspector.html
WebCore/page/inspector/inspector.js
WebCore/page/inspector/utilities.js

index 6263ebc3db94137dea073763148d5fac22ca78bd..e342bc2f8a7f2c71a32ad3e46ecd877eeb4be8a5 100644 (file)
@@ -1,3 +1,32 @@
+2007-11-24  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Adam Roben.
+
+        Bug 16121: Web Inspector needs helper functions that pass a 'this' object to
+        addEventListener and setTimeout
+        http://bugs.webkit.org/show_bug.cgi?id=16121
+
+        Add Function.prototype.bind. This helper will return a wrapper function
+        that will call the original function with the supplied arguments
+        and using the supplied 'this' object.
+
+        * page/inspector/Database.js: Remove a use of setTimeout by
+          inheriting some common functions from Resource.
+        * page/inspector/DatabasePanel.js: Use the new bind function.
+        * page/inspector/ConsolePanel.js: Ditto.
+        * page/inspector/DocumentPanel.js: Ditto.
+        * page/inspector/NetworkPanel.js: Ditto.
+        * page/inspector/PropertiesSection.js: Ditto.
+        * page/inspector/Resource.js: Ditto.
+        * page/inspector/SidebarPane.js: Ditto.
+        * page/inspector/inspector.html: Moved Database.js after Resource.js,
+          now that Database.js uses it.
+        * page/inspector/inspector.js: Use the new bind function. Also
+          removed a setTimeout used for the localized strings code. There is
+          now a load event listener added to the localized strings script
+          element that will call WebInspector.loaded.
+        * page/inspector/utilities.js: Add Function.prototype.bind.
+
 2007-11-24  Timothy Hatcher  <timothy@apple.com>
 
         Reviewed by Adam Roben.
index 563d332a41ad4d9f89e012a4a97072008cbf94a9..0b3be1faf3f1d572a2241cecb6610660bc9bccb5 100644 (file)
@@ -39,14 +39,13 @@ WebInspector.ConsolePanel = function()
     this.messageList.className = "console-message-list";
     this.element.appendChild(this.messageList);
 
-    var console = this;
-    this.messageList.addEventListener("click", function(event) { console.messageListClicked(event) }, true);
+    this.messageList.addEventListener("click", this.messageListClicked.bind(this), true);
 
     this.consolePrompt = document.createElement("textarea");
     this.consolePrompt.className = "console-prompt";
     this.element.appendChild(this.consolePrompt);
 
-    this.consolePrompt.addEventListener("keydown", function(event) { console.promptKeypress(event) }, false);
+    this.consolePrompt.addEventListener("keydown", this.promptKeypress.bind(this), false);
 }
 
 WebInspector.ConsolePanel.prototype = {
index 99353fc819d453227b311d4612f7c99fb7a84b30..36e89da822b91044967770f564e6bdf22cc7b38a 100644 (file)
@@ -95,14 +95,6 @@ WebInspector.Database.prototype = {
         return WebInspector.resourceCategories.databases;
     },
 
-    updateTitleSoon: function()
-    {
-        if (this.updateTitleTimeout)
-            return;
-        var _self = this;
-        this.updateTitleTimeout = setTimeout(function () { _self.updateTitle() }, 0);
-    },
-
     updateTitle: function()
     {
         delete this.updateTitleTimeout;
@@ -128,26 +120,10 @@ WebInspector.Database.prototype = {
         return this._panel;
     },
 
-    select: function()
-    {
-        WebInspector.navigateToResource(this);
-    },
-
-    deselect: function()
-    {
-        this.listItem.deselect(true);
-        if (WebInspector.currentPanel === this._panel)
-            WebInspector.currentPanel = null;
-    },
-
-    attach: function()
-    {
-        this.panel.attach();
-    },
-
-    detach: function()
-    {
-        if (this._panel)
-            this.panel.detach();
-    }
+    // Inherit the other functions from the Resource prototype.
+    updateTitleSoon: WebInspector.Resource.prototype.updateTitleSoon,
+    select: WebInspector.Resource.prototype.select,
+    deselect: WebInspector.Resource.prototype.deselect,
+    attach: WebInspector.Resource.prototype.attach,
+    detach: WebInspector.Resource.prototype.detach
 }
index d1489bc52dbefa7b6ae0d9b95a9ec3d0762ba186..87ba0fef29c8b8c04b4c8891f1f9b75acbbb84d3 100644 (file)
@@ -40,8 +40,7 @@ WebInspector.DatabasePanel = function(database, views)
     this.queryPromptElement.className = "database-prompt";
     this.element.appendChild(this.queryPromptElement);
 
-    var panel = this;
-    this.queryPromptElement.addEventListener("keydown", function(event) { panel.queryInputKeypress(event) }, false);
+    this.queryPromptElement.addEventListener("keydown", this.queryInputKeypress.bind(this), false);
 
     this.queryPromptHistory = [];
     this.queryPromptHistoryOffset = 0;
@@ -52,6 +51,7 @@ WebInspector.DatabasePanel = function(database, views)
     queryView.commandListElement.className = "database-command-list";
     queryView.contentElement.appendChild(queryView.commandListElement);
 
+    var panel = this;
     queryView.show = function()
     {
         panel.queryPromptElement.focus();
@@ -69,7 +69,7 @@ WebInspector.DatabasePanel = function(database, views)
     browseView.reloadTableElement.appendChild(document.createElement("img"));
     browseView.reloadTableElement.className = "database-table-reload";
     browseView.reloadTableElement.title = WebInspector.UIString("Reload");
-    browseView.reloadTableElement.addEventListener("click", function() { panel.updateTableList(); panel.updateTableBrowser() }, false);
+    browseView.reloadTableElement.addEventListener("click", this.reloadClicked.bind(this), false);
 
     browseView.show = function()
     {
@@ -135,6 +135,12 @@ return {
         }
     },
 
+    reloadClicked: function()
+    {
+        this.updateTableList();
+        this.updateTableBrowser();
+    },
+
     updateTableList: function()
     {
         var browseView = this.views.browse;
@@ -145,7 +151,6 @@ return {
             var panel = this;
             var changeTableFunction = function()
             {
-                var browseView = panel.views.browse;
                 var index = browseView.tableSelectElement.selectedIndex;
                 if (index != -1)
                     panel.currentTable = browseView.tableSelectElement.options[index].value;
index 228505057d8aa998d4429074ca4c4d7f2916de7f..7505affddd294f8afca973a8956c8c33a4093dad 100644 (file)
@@ -83,7 +83,7 @@ WebInspector.DocumentPanel = function(resource, views)
 
     domView.sidebarResizeElement = document.createElement("div");
     domView.sidebarResizeElement.className = "sidebar-resizer-vertical sidebar-resizer-vertical-right";
-    domView.sidebarResizeElement.addEventListener("mousedown", function(event) { panel.rightSidebarResizerDragStart(event) }, false);
+    domView.sidebarResizeElement.addEventListener("mousedown", this.rightSidebarResizerDragStart.bind(this), false);
 
     domView.contentElement.appendChild(domView.sideContentElement);
     domView.contentElement.appendChild(domView.sidebarElement);
@@ -384,8 +384,7 @@ WebInspector.DocumentPanel.prototype = {
 
         if (document.body.offsetWidth <= 0) {
             // The stylesheet hasn't loaded yet, so we need to update later.
-            var panel = this;
-            setTimeout(function() { panel.updateBreadcrumbSizes() }, 0);
+            setTimeout(this.updateBreadcrumbSizes.bind(this), 0);
             return;
         }
 
@@ -755,8 +754,7 @@ WebInspector.DOMNodeTreeElement.prototype = {
 
         if (document.body.offsetWidth <= 0) {
             // The stylesheet hasn't loaded yet, so we need to update later.
-            var element = this;
-            setTimeout(function() { element.updateSelection() }, 0);
+            setTimeout(this.updateSelection.bind(this), 0);
             return;
         }
 
@@ -771,8 +769,7 @@ WebInspector.DOMNodeTreeElement.prototype = {
 
     onattach: function()
     {
-        var element = this;
-        this.listItemElement.addEventListener("mousedown", function(event) { element.onmousedown(event) }, false);
+        this.listItemElement.addEventListener("mousedown", this.onmousedown.bind(this), false);
     },
 
     onpopulate: function()
index c6fbdb42ea2289663debf417d99a854504c115b8..2f000ee79cada37835cd5d6d0d267ca48920d36e 100644 (file)
@@ -46,8 +46,7 @@ WebInspector.NetworkPanel = function()
 
     this.resourcesElement = document.createElement("div");
     this.resourcesElement.className = "network-resources";
-    var panel = this;
-    this.resourcesElement.addEventListener("click", function(event) { return panel.onClick(event) }, false);
+    this.resourcesElement.addEventListener("click", this.resourcesClicked.bind(this), false);
     this.timelineElement.appendChild(this.resourcesElement);
 
     var graphArea = document.createElement("div");
@@ -60,7 +59,7 @@ WebInspector.NetworkPanel = function()
 
     this.graphModeSelectElement = document.createElement("select");
     this.graphModeSelectElement.className = "network-graph-mode";
-    this.graphModeSelectElement.addEventListener("change", function(event) { return panel.onModeChange(event) }, false);
+    this.graphModeSelectElement.addEventListener("change", this.changeGraphMode.bind(this), false);
     this.graphLabelElement.appendChild(this.graphModeSelectElement);
     this.graphLabelElement.appendChild(document.createElement("br"));
 
@@ -112,7 +111,7 @@ WebInspector.NetworkPanel.prototype = {
         this.updateTimelineDividersIfNeeded();
     },
 
-    onClick: function(event)
+    resourcesClicked: function(event)
     {
         // If the click wasn't inside a network resource row, ignore it.
         var resourceElement = event.target.firstParentOrSelfWithClass("network-resource");
@@ -134,7 +133,7 @@ WebInspector.NetworkPanel.prototype = {
         resourceElement.timelineEntry.toggleShowingInfo();
     },
 
-    onModeChange: function(event)
+    changeGraphMode: function(event)
     {
         this.updateSummaryGraph();
     },
@@ -230,9 +229,7 @@ WebInspector.NetworkPanel.prototype = {
     {
         if ("sortTimelineEntriesTimeout" in this)
             return;
-
-        var _self = this;
-        this.sortTimelineEntriesTimeout = setTimeout(function () { _self.sortTimelineEntriesIfNeeded() }, 500);
+        this.sortTimelineEntriesTimeout = setTimeout(this.sortTimelineEntriesIfNeeded.bind(this), 500);
     },
 
     sortTimelineEntriesIfNeeded: function()
@@ -283,9 +280,7 @@ WebInspector.NetworkPanel.prototype = {
     {
         if ("updateTimelineDividersTimeout" in this)
             return;
-
-        var _self = this;
-        this.updateTimelineDividersTimeout = setTimeout(function () { _self.updateTimelineDividersIfNeeded() }, 500);
+        this.updateTimelineDividersTimeout = setTimeout(this.updateTimelineDividersIfNeeded.bind(this), 500);
     },
 
     updateTimelineDividersIfNeeded: function()
@@ -302,8 +297,7 @@ WebInspector.NetworkPanel.prototype = {
 
         if (document.body.offsetWidth <= 0) {
             // The stylesheet hasn't loaded yet, so we need to update later.
-            var panel = this;
-            setTimeout(function () { panel.updateTimelineDividersIfNeeded() }, 0);
+            setTimeout(this.updateTimelineDividersIfNeeded.bind(this), 0);
             return;
         }
 
@@ -337,9 +331,7 @@ WebInspector.NetworkPanel.prototype = {
     {
         if ("refreshAllTimelineEntriesTimeout" in this)
             return;
-
-        var _self = this;
-        this.refreshAllTimelineEntriesTimeout = setTimeout(function () { _self.refreshAllTimelineEntries() }, 500, skipBoundryUpdate, skipTimelineSort, immediate);
+        this.refreshAllTimelineEntriesTimeout = setTimeout(this.refreshAllTimelineEntries.bind(this), 500, skipBoundryUpdate, skipTimelineSort, immediate);
     },
 
     refreshAllTimelineEntries: function(skipBoundryUpdate, skipTimelineSort, immediate)
@@ -592,9 +584,7 @@ WebInspector.NetworkPanel.prototype = {
     {
         if ("updateSummaryGraphTimeout" in this)
             return;
-
-        var _self = this;
-        this.updateSummaryGraphTimeout = setTimeout(function () { _self.updateSummaryGraph() }, 500);
+        this.updateSummaryGraphTimeout = setTimeout(this.updateSummaryGraph.bind(this), 500);
     },
 
     updateSummaryGraph: function()
@@ -703,8 +693,7 @@ WebInspector.NetworkTimelineEntry = function(panel, resource)
     this.showingTipButton = this.resource.tips.length;
     this.fileElement.insertBefore(this.tipButtonElement, this.fileElement.firstChild);
 
-    var entry = this;
-    this.tipButtonElement.addEventListener("click", function(event) { entry.toggleTipBalloon(event) }, false );
+    this.tipButtonElement.addEventListener("click", this.toggleTipBalloon.bind(this), false );
 
     this.areaElement = document.createElement("div");
     this.areaElement.className = "network-area";
index 738240e20f2136d60cb10066fdf298c4ba75ca55..b2a347305e942a39a2f4c05b38f512c8950864b5 100644 (file)
@@ -42,9 +42,7 @@ WebInspector.PropertiesSection = function(title, subtitle)
 
     this.headerElement.appendChild(this.titleElement);
     this.headerElement.appendChild(this.subtitleElement);
-
-    var section = this;
-    this.headerElement.addEventListener("click", function() { section.expanded = !section.expanded; }, false);
+    this.headerElement.addEventListener("click", this.toggleExpanded.bind(this), false);
 
     this.propertiesElement = document.createElement("ol");
     this.propertiesElement.className = "properties";
@@ -132,5 +130,10 @@ WebInspector.PropertiesSection.prototype = {
             return;
         this._expanded = false;
         this.element.removeStyleClass("expanded");
+    },
+
+    toggleExpanded: function()
+    {
+        this.expanded = !this.expanded;
     }
 }
index 0f9cb8cb661617bcf75204695ab69af58790cfc7..620b6e8eeeab4461383d382fc3bec4ad22d7e486 100644 (file)
@@ -496,8 +496,7 @@ WebInspector.Resource.prototype = {
     {
         if (this.updateTitleTimeout)
             return;
-        var _self = this;
-        this.updateTitleTimeout = setTimeout(function () { _self.updateTitle() }, 0);
+        this.updateTitleTimeout = setTimeout(this.updateTitle.bind(this), 0);
     },
 
     updateTitle: function()
index fda27b61ff251bbdc5c61d96ad9f0f61d13ce4d8..53f9d6d673f5a533f4cd4c5b4453b28dc19666c2 100644 (file)
@@ -33,9 +33,7 @@ WebInspector.SidebarPane = function(title)
 
     this.titleElement = document.createElement("div");
     this.titleElement.className = "title";
-
-    var pane = this;
-    this.titleElement.addEventListener("click", function() { pane.expanded = !pane.expanded; }, false);
+    this.titleElement.addEventListener("click", this.toggleExpanded.bind(this), false);
 
     this.bodyElement = document.createElement("div");
     this.bodyElement.className = "body";
@@ -116,5 +114,10 @@ WebInspector.SidebarPane.prototype = {
         this.element.removeStyleClass("expanded");
         if (this.oncollapse)
             this.oncollapse(this);
+    },
+
+    toggleExpanded: function()
+    {
+        this.expanded = !this.expanded;
     }
 }
index 7c39869c56b936bcc7532c0d702cff63b9472be9..1d95e67c245b14f039ef826213cc3b01e147c4b6 100644 (file)
@@ -33,9 +33,9 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     <script type="text/javascript" src="utilities.js"></script>
     <script type="text/javascript" src="treeoutline.js"></script>
     <script type="text/javascript" src="inspector.js"></script>
-    <script type="text/javascript" src="Database.js"></script>
     <script type="text/javascript" src="Resource.js"></script>
     <script type="text/javascript" src="ResourceCategory.js"></script>
+    <script type="text/javascript" src="Database.js"></script>
     <script type="text/javascript" src="SidebarPane.js"></script>
     <script type="text/javascript" src="PropertiesSection.js"></script>
     <script type="text/javascript" src="MetricsSidebarPane.js"></script>
index 22fac9e436a59dd938e8aa5a2e995df4222ed575..fce858ab6eb51374d90a8d71b3f2703873bc998a 100644 (file)
@@ -210,17 +210,6 @@ var WebInspector = {
     }
 }
 
-WebInspector.setupLocalizedString = function(event)
-{
-    var localizedStringsURL = InspectorController.localizedStringsURL();
-    if (localizedStringsURL) {
-        var localizedStringsScriptElement = document.createElement("script");
-        localizedStringsScriptElement.type = "text/javascript";
-        localizedStringsScriptElement.src = localizedStringsURL;
-        document.getElementsByTagName("head").item(0).appendChild(localizedStringsScriptElement);
-    }
-}
-
 WebInspector.loaded = function()
 {
     this.fileOutline = new TreeOutline(document.getElementById("list"));
@@ -259,29 +248,30 @@ WebInspector.loaded = function()
 
     this.addMainEventListeners(document);
 
-    window.addEventListener("unload", function(event) { WebInspector.windowUnload(event) }, true);
-    window.addEventListener("resize", function(event) { WebInspector.windowResize(event) }, true);
+    window.addEventListener("unload", this.windowUnload.bind(this), true);
+    window.addEventListener("resize", this.windowResize.bind(this), true);
 
-    document.addEventListener("mousedown", function(event) { WebInspector.changeFocus(event) }, true);
-    document.addEventListener("focus", function(event) { WebInspector.changeFocus(event) }, true);
-    document.addEventListener("keypress", function(event) { WebInspector.documentKeypress(event) }, true);
-    document.addEventListener("beforecopy", function(event) { WebInspector.documentCanCopy(event) }, true);
-    document.addEventListener("copy", function(event) { WebInspector.documentCopy(event) }, true);
+    document.addEventListener("mousedown", this.changeFocus.bind(this), true);
+    document.addEventListener("focus", this.changeFocus.bind(this), true);
+    document.addEventListener("keypress", this.documentKeypress.bind(this), true);
+    document.addEventListener("beforecopy", this.documentCanCopy.bind(this), true);
+    document.addEventListener("copy", this.documentCopy.bind(this), true);
 
     document.getElementById("back").title = WebInspector.UIString("Show previous panel.");
     document.getElementById("forward").title = WebInspector.UIString("Show next panel.");
 
     document.getElementById("search").setAttribute("placeholder", WebInspector.UIString("Search"));
 
-    document.getElementById("back").addEventListener("click", function(event) { WebInspector.back() }, true);
-    document.getElementById("forward").addEventListener("click", function(event) { WebInspector.forward() }, true);
+    document.getElementById("back").addEventListener("click", this.back.bind(this), true);
+    document.getElementById("forward").addEventListener("click", this.forward.bind(this), true);
     this.updateBackForwardButtons();
 
-    document.getElementById("attachToggle").addEventListener("click", function(event) { WebInspector.toggleAttach() }, true);
-    document.getElementById("statusToggle").addEventListener("click", function(event) { WebInspector.toggleStatusArea() }, true);
-    document.getElementById("sidebarResizeWidget").addEventListener("mousedown", WebInspector.sidebarResizerDragStart, true);
-    document.getElementById("sidebarResizer").addEventListener("mousedown", WebInspector.sidebarResizerDragStart, true);
-    document.getElementById("searchResultsResizer").addEventListener("mousedown", WebInspector.searchResultsResizerDragStart, false);
+    document.getElementById("attachToggle").addEventListener("click", this.toggleAttach.bind(this), true);
+    document.getElementById("statusToggle").addEventListener("click", this.toggleStatusArea.bind(this), true);
+
+    document.getElementById("sidebarResizeWidget").addEventListener("mousedown", this.sidebarResizerDragStart, true);
+    document.getElementById("sidebarResizer").addEventListener("mousedown", this.sidebarResizerDragStart, true);
+    document.getElementById("searchResultsResizer").addEventListener("mousedown", this.searchResultsResizerDragStart, true);
 
     document.body.addStyleClass("detached");
 
@@ -290,11 +280,15 @@ WebInspector.loaded = function()
 
 var windowLoaded = function()
 {
-    WebInspector.setupLocalizedString(event);
-
-    // Delay calling loaded to give time for the localized strings file to load.
-    // Calling it too early will cause localized string lookups to fail.
-    setTimeout(function() { WebInspector.loaded() }, 0);
+    var localizedStringsURL = InspectorController.localizedStringsURL();
+    if (localizedStringsURL) {
+        var localizedStringsScriptElement = document.createElement("script");
+        localizedStringsScriptElement.addEventListener("load", WebInspector.loaded.bind(WebInspector), false);
+        localizedStringsScriptElement.type = "text/javascript";
+        localizedStringsScriptElement.src = localizedStringsURL;
+        document.getElementsByTagName("head").item(0).appendChild(localizedStringsScriptElement);
+    } else
+        WebInspector.loaded();
 
     delete windowLoaded;
     window.removeEventListener("load", windowLoaded, false);
index 3fcd1690da73a89c98f950b6586c5e01cf1dba66..6f06d56fb5d757baf48a6fad929aa0203cdaa1cd 100644 (file)
@@ -79,14 +79,19 @@ Object.describe = function(obj, abbreviated)
 Object.sortedProperties = function(obj)
 {
     var properties = [];
-    for (var prop in obj) {
+    for (var prop in obj)
         properties.push(prop);
-    }
-
     properties.sort();
     return properties;
 }
 
+Function.prototype.bind = function(thisObject)
+{
+    var func = this;
+    var args = Array.prototype.slice.call(arguments, 1);
+    return function() { return func.apply(thisObject, args.concat(Array.prototype.slice.call(arguments, 0))) };
+}
+
 Element.prototype.removeStyleClass = function(className) 
 {
     // Test for the simple case before using a RegExp.
@@ -140,7 +145,6 @@ Node.prototype.firstParentOrSelfWithNodeName = function(nodeName)
     for (var node = this; node && (node !== document); node = node.parentNode)
         if (node.nodeName.toLowerCase() === nodeName.toLowerCase())
             return node;
-
     return null;
 }
 
@@ -149,7 +153,6 @@ Node.prototype.firstParentOrSelfWithClass = function(className)
     for (var node = this; node && (node !== document); node = node.parentNode)
         if (node.nodeType === Node.ELEMENT_NODE && node.hasStyleClass(className))
             return node;
-
     return null;
 }
 
@@ -157,7 +160,6 @@ Node.prototype.firstParentWithClass = function(className)
 {
     if (!this.parentNode)
         return null;
-
     return this.parentNode.firstParentOrSelfWithClass(className);
 }