Skip to content
Permalink
Browse files

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

  • Loading branch information
dmethvin committed Aug 24, 2012
1 parent c01e022 commit 2263134b224fe03b90552369b5007220747fbaf0
Showing with 9 additions and 2 deletions.
  1. +1 −1 src/data.js
  2. +8 −1 test/unit/data.js
@@ -1,4 +1,4 @@
var rbrace = /^(?:\{.*\}|\[.*\])$/,
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
rmultiDash = /([A-Z])/g;

jQuery.extend({
@@ -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();
});

0 comments on commit 2263134

Please sign in to comment.
You can’t perform that action at this time.