Skip to main content

Bug Tracker

Side navigation

#5729 closed bug (fixed)

Opened December 29, 2009 08:35PM UTC

Closed November 14, 2010 04:20AM UTC

`Expando` cleanup in `.html()` and `.clone()` is too greedy

Reported by: maranomynet Owned by:
Priority: major Milestone: 1.4
Component: core Version: 1.4a2
Keywords: Cc:
Blocked by: Blocking:
Description

There's a bug in the rinlinejQuery regexp that makes it a bit too "greedy":

jQuery('<p> jQuery12="0" </p>').html();  // returns: "  "

Proposed fix:

In manipulation.js, line 1 should be changed to something like:

var rinlinejQuery = /(<\\w[^<]+) jQuery\\d+="(?:\\d+|null)"/g,
                     ^^^^^^^^^^

and the replacements in lines 156 and 176 to reinsert the first matching parenthesis:

.replace(rinlinejQuery, "$1")
                        ^^^^

Actually this whole rinlinejQuery business is a bit of an ugly hack. Would it perhaps be feasible to fix the expando value in a way similar to what Andrea Giammarchi suggests in this jquery-dev post?

Attachments (0)
Change History (1)

Changed November 14, 2010 04:20AM UTC by dmethvin comment:1

resolution: → fixed
status: newclosed

This regexp was optimized as part of the 1.4.3 fixes.