Skip to content

$.parseHTML() creates anchor elements with empty href property in 1.12/2.2 in Chrome #2941

@vmagik

Description

@vmagik

$.parseHTML() seems to be broken in jQuery v1.12.0 and later for Chrome
This code shows empty string in Chrome but it is "test.html" in other browsers.
In jQuery 1.11.3 Chrome was OK too.

<script type="text/javascript" src="jquery-1.12.1.js"></script>
<script type="text/javascript">
    function test()
    {
        var html = '<a href="test.html"></a>';
        var ref = $.parseHTML(html);

        alert(ref[0].href);
    }
</script>

EDIT (@mgol): I modified the alert to alert the href property of the anchor element; originally the test case was alerting the element (alert(ref)) which meant it relied on its stringification.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions