News for hackers. Stuff that matters.
Re:"@" on Twitter by xg15 on Saturday April 28, 2018 @02:41PM (#16948931)
Do I get this right that jQuery, for developer convenience, content-sniffs the value of "data-" attributes?

I.e., if the value looks like JSON, it will parse it and return the object tree, otherwise it will return the original value as a string?

This sounds like a horrible idea in general - I'd say the authors of this forgetting that certain english words by themselves are valid JSON is a nice cherry on top but hardly the worst problem caused by this.

Re:"@" on Twitter by Alexendoo on Saturday April 28, 2018 @05:12PM (#16949437)
Sort of - there's a jQuery API that does content sniffing called .data(), it's for storing and retrieving arbitrary data on elements. The problem was that they used this API to read from an element where they should have used .attr(), which returns a string.