Fix #10863. Allow newlines in JSON data- attributes.

This commit is contained in:
Dave Methvin 2012-08-23 22:19:06 -04:00
parent c01e022f33
commit 2263134b22
2 changed files with 9 additions and 2 deletions

View File

@ -1,4 +1,4 @@
var rbrace = /^(?:\{.*\}|\[.*\])$/,
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
rmultiDash = /([A-Z])/g;
jQuery.extend({

View File

@ -646,5 +646,12 @@ test( "Only check element attributes once when calling .data() - #8909", functio
// clean up data cache
element.remove();
});
test( "JSON data- attributes can have newlines", function() {
expect(1);
var x = jQuery("<div data-some='{\n\"foo\":\n\t\"bar\"\n}'></div>");
equal( x.data("some").foo, "bar", "got a JSON data- attribute with spaces" );
x.remove();
});