diff options
| author | Jez Ng | 2012-10-24 15:33:56 -0400 |
|---|---|---|
| committer | Jez Ng | 2012-10-24 15:33:56 -0400 |
| commit | 647fd97bef55d2371e87f0cd418ddff62f36800e (patch) | |
| tree | e8dc20c1ebac8653d47a3fe6ca5c01819674a700 | |
| parent | f3f80eed2a3a58327e4361c7deb57d87cab4b4bd (diff) | |
| download | vimium-647fd97bef55d2371e87f0cd418ddff62f36800e.tar.bz2 | |
Use insertCSS() API instead of manually created style element.
For some reason addCssToPage seemed to break on Chrome 24.
Closes #676.
| -rw-r--r-- | background_scripts/main.coffee | 4 | ||||
| -rw-r--r-- | content_scripts/link_hints.coffee | 1 | ||||
| -rw-r--r-- | lib/dom_utils.coffee | 15 |
3 files changed, 4 insertions, 16 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index a3857d61..b56d391c 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -318,6 +318,10 @@ updateScrollPosition = (tab, scrollX, scrollY) -> chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) -> return unless changeInfo.status == "loading" # only do this once per URL change + chrome.tabs.insertCSS tabId, + allFrames: true + code: Settings.get("userDefinedLinkHintCss") + runAt: "document_start" updateOpenTabs(tab) updateActiveState(tabId)) diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 55a78036..5c7f6510 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -60,7 +60,6 @@ LinkHints = @setOpenLinkMode(mode) hintMarkers = @markerMatcher.fillInMarkers(@createMarkerFor(el) for el in @getVisibleClickableElements()) - DomUtils.addCssToPage(settings.get("userDefinedLinkHintCss"), "vimiumLinkHintCss") # Note(philc): Append these markers as top level children instead of as child nodes to the link itself, # because some clickable elements cannot contain children, e.g. submit buttons. This has the caveat # that if you scroll the page and the link has position=fixed, the marker will not stay fixed. diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index 501e43a5..a99cb5a6 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -1,20 +1,5 @@ DomUtils = # - # Adds the given CSS to the page. - # - addCssToPage: (css, id) -> - return if document.getElementById(id) - head = document.getElementsByTagName("head")[0] - if (!head) - head = document.createElement("head") - document.documentElement.appendChild(head) - style = document.createElement("style") - style.id = id - style.type = "text/css" - style.appendChild(document.createTextNode(css)) - head.appendChild(style) - - # # Runs :callback if the DOM has loaded, otherwise runs it on load # documentReady: do -> |
