From c4dec72dcd8d618ee60ec39e9b047903c9835a7f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 21 Nov 2013 14:32:28 -0800 Subject: [PATCH] Return early when document.body matches selector --- src/menu-manager.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index 51bc745a3..5b5fd868d 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -34,6 +34,8 @@ class MenuManager # # Returns true to include the selector, false otherwise. includeSelector: (selector) -> + return true if document.body.webkitMatchesSelector(selector) + unless @testEditor? @testEditor = document.createElement('div') @testEditor.classList.add('editor') @@ -41,7 +43,7 @@ class MenuManager testBody.classList.add(document.body.classList.toString().split(' ')...) testBody.appendChild(@testEditor) - document.body.webkitMatchesSelector(selector) or @testEditor.webkitMatchesSelector(selector) + @testEditor.webkitMatchesSelector(selector) # Public: Refreshes the currently visible menu. update: ->