Invalid HTML passed into .html() throws 'tmp is null' error
|Reported by:||patrick.guinness@…||Owned by:|
An error is thrown in jQuery 2.0.2, whereas jQuery 1.9.1 appears to strip out the offending tags.
2.0.2 example: http://jsfiddle.net/pguinness/ndQ6R/2/
1.9.1 example: http://jsfiddle.net/pguinness/axDzX/2/
Looks like the issue is occurring in the buildFragment() method. jQuery 1.9.1 runs the HTML content through the createSafeFragment() method (line 6564), whereas 2.0.2 uses the native .createDocumentFragment() (line 5779) without doing any additional parsing.
Tested on Mac OS 10.8.3 in the following browsers:
Chrome 27.0.1453.93 Firefox 21.0 Safari 6.0.4
Change History (8)
comment:2 Changed 4 years ago by dmethvin
- Component changed from unfiled to manipulation
- Milestone changed from None to 2.next
- Priority changed from undecided to low
comment:7 Changed 3 years ago by ruado1987
- Resolution set to fixed
- Status changed from open to closed