Reputation: 2367
We are using data- prefix in our html tags to attach some data to our elements. We can get that data by this.dataset property in Chrome and as we are too lazy to check if our functions work under different browsers/engines(by the way i have to support FF and Chrome only, no safari, no IE), now our app is failing under FF because FF does not know what is "this.dataset". Is it going to be supported by FF too(our app is not going to be ready for a month or more), or should we re-write our code?
Upvotes: 1
Views: 1281
Reputation: 49142
In the meantime you can use polyfills for dataset so you can use that API:
http://eligrey.com/blog/post/html-5-dataset-support
https://github.com/remy/polyfills/blob/master/dataset.js
Upvotes: 1
Reputation: 35064
The patch for dataset support is not going to ship in a Firefox release until at least August. So if you need something in a month, you shouldn't rely on it.
See https://bugzilla.mozilla.org/show_bug.cgi?id=560112 for details.
Upvotes: 1
Reputation: 72965
I'd rewrite it, as I haven't seen anything in gecko to suggest this is coming soon, and it's not particularly hard to write.
You may be interested to know that jQuery has it's $.data() method that does what you want – you may want to look at the source to see how they tackle this, or just to use it as is.
Upvotes: 0