mirror of
https://github.com/atom/atom.git
synced 2026-02-12 23:55:10 -05:00
Add window.removeStylesheet
This commit is contained in:
@@ -65,9 +65,14 @@ windowAdditions =
|
||||
|
||||
requireStylesheet: (path) ->
|
||||
unless fullPath = require.resolve(path)
|
||||
throw new Error("requireStylesheet could not find a file at path '#{path}'")
|
||||
throw new Error("Could not find a file at path '#{path}'")
|
||||
window.applyStylesheet(fullPath, fs.read(fullPath))
|
||||
|
||||
removeStylesheet: (path) ->
|
||||
unless fullPath = require.resolve(path)
|
||||
throw new Error("Could not find a file at path '#{path}'")
|
||||
$("head style[id='#{fullPath}']").remove()
|
||||
|
||||
applyStylesheet: (id, text) ->
|
||||
unless $("head style[id='#{id}']").length
|
||||
$('head').append "<style id='#{id}'>#{text}</style>"
|
||||
|
||||
Reference in New Issue
Block a user