diff --git a/spec/app/window-spec.coffee b/spec/app/window-spec.coffee index efe050d53..baa14f409 100644 --- a/spec/app/window-spec.coffee +++ b/spec/app/window-spec.coffee @@ -32,15 +32,15 @@ describe "Window", -> describe "requireStylesheet(path)", -> it "synchronously loads the stylesheet at the given path and installs a style tag for it in the head", -> - $('head style[path*="atom.css"]').remove() + $('head style[id*="atom.css"]').remove() lengthBefore = $('head style').length requireStylesheet('atom.css') expect($('head style').length).toBe lengthBefore + 1 - styleElt = $('head style[path*="atom.css"]') + styleElt = $('head style[id*="atom.css"]') fullPath = require.resolve('atom.css') - expect(styleElt.attr('path')).toBe fullPath + expect(styleElt.attr('id')).toBe fullPath expect(styleElt.text()).toBe fs.read(fullPath) # doesn't append twice diff --git a/src/app/window.coffee b/src/app/window.coffee index 4c65fc34e..fe0666a60 100644 --- a/src/app/window.coffee +++ b/src/app/window.coffee @@ -53,9 +53,11 @@ windowAdditions = requireStylesheet: (path) -> fullPath = require.resolve(path) - content = fs.read(fullPath) - return if $("head style[path='#{fullPath}']").length - $('head').append "" + window.applyStylesheet(fullPath, fs.read(fullPath)) + + applyStylesheet: (id, text) -> + unless $("head style[id='#{id}']").length + $('head').append "" requireExtension: (name) -> extensionPath = require.resolve name