When is a stylesheet added to document.styleSheets

后端 未结 2 1326
暖寄归人
暖寄归人 2021-02-20 02:17

I\'m trying to dynamically add a css stylesheet rule using javascript, something like example 2 here.

It works most of the time, but there seems to be a race condition t

2条回答
  •  北荒
    北荒 (楼主)
    2021-02-20 02:36

    This should help: 'When is a stylesheet really loaded'

    As for 'Example 2'. It will break if there is stylesheet loading when you call addStylesheetRules(), of course that is in Chrome.

提交回复
热议问题