dvtng / jss

JavaScript library for getting and setting CSS stylesheet rules
335 stars 54 forks source link

Fix crashing in FireFox #39

Open AtmanActive opened 8 years ago

AtmanActive commented 8 years ago

Fixed:

1) Fix security error for getAll in FireFox when there are foreign domain CSS files included On big sites with dozens of CSS files included, where some of them are included from other domains, FireFox throws security error on getAll because jss traverses all available CSS files. To bypass this error and make it work in FireFox, I have added a second argument to getAll function: sheet_name, where consumers can optionally specify which CSS filename to take into account. This enables getAll to work on only one CSS file and thus to avoid security error.

2) FireFox adds properties that are undefined on read, which then crashes set function later on. In a loop where one uses getAll to get data and then later set to create new data structures, in FireFox, jss was crashing because FireFox delivers a lot of properties with value 'undefined'.