Bug Tracker

Ticket #10515 (closed feature: wontfix)

Opened 4 years ago

Last modified 3 years ago

Meta: Investigate viability of insertAdjacentHTML use

Reported by: rwaldron Owned by: rwaldron
Priority: low Milestone: 1.next
Component: manipulation Version: 1.7b2
Keywords: Cc:
Blocking: Blocked by:


The latest Firefox will have support for this, I'm wondering if support is wide enough now to consider adding it to any of the manipulation logic paths.

Change History

comment:1 Changed 4 years ago by rwaldron

  • Owner set to rwaldron
  • Priority changed from undecided to low
  • Status changed from new to assigned
  • Component changed from unfiled to manipulation
  • Milestone changed from None to 1.8

comment:2 Changed 4 years ago by aymeric@…

It's an awesome idea. The Mozilla Team wrote an article about the better performance of this function:  http://hacks.mozilla.org/2011/11/insertadjacenthtml-enables-faster-html-snippet-injection/

comment:3 Changed 4 years ago by dmethvin

It would be nice if we could totally replace our fragment cache with insertAdjacentHTML instead. That would mitigate the code bloat and eliminate the pseudo-leak that the frag cache causes. However we'd need to see how iAH handles the cases already in .clean() which are primarily IE 6/7/8 workarounds.

comment:4 Changed 4 years ago by timmywil

If it removes the need for clean, it would be worth the extra codepath.

comment:5 Changed 4 years ago by timmywil

#10804 is a duplicate of this ticket.

comment:6 Changed 4 years ago by dmethvin

  • Blocking 10903 added

(In #10903) None of the HTML processing code in jQuery.clean or jQuery.buildFragment currently attaches content to the document, that's done later when the method-specific callback (e.g., append, prepend, before, after) is called. So this isn't a simple change and a very cornery case.

However, we've been talking about using insertAdjacentHTML in #10515 which might solve this problem so I'll leave it open. If it can't be worked in there I think we will close this wontfix.

comment:7 Changed 3 years ago by dmethvin

  • Blocking 10903 removed

comment:8 Changed 3 years ago by mikesherov

  • Milestone changed from 1.8 to 1.next

comment:9 Changed 3 years ago by dmethvin

  • Type changed from enhancement to feature

Bulk change from enhancement to feature.

comment:10 Changed 3 years ago by dmethvin

Pull request at  https://github.com/jquery/jquery/pull/1095 for one narrow but common case, $(selector).append(html), but I'd like to see perfs before landing it.

comment:11 Changed 3 years ago by dmethvin

  • Status changed from assigned to closed
  • Resolution set to wontfix

Thoroughly investigated by @orkel in  https://github.com/jquery/jquery/pull/1200 and we came to the conclusion that there is no significant benefit.

Note: See TracTickets for help on using tickets.