Side navigation
#4706 closed bug (fixed)
Opened May 30, 2009 08:11PM UTC
Closed June 15, 2010 03:12AM UTC
Ajax load(...) works wrong with full HTML documents
Reported by: | hvesalai | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | ajax | Version: | 1.3.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
The ajax "load( url, data, callback )" function documentation states that the default selector is "body > *". This is not what actually gets loaded.
The load(...) function uses the "jQuery( html, ownerDocument )" to parse the HTML that is loaded. The documentation of jQuery(...) states: "The HTML string cannot contain elements that are invalid within a div, such as html, head, body, or title elements." This is correct, i.e. documentation actually describes the implementation.
Since the jQuery(...) will not return the body element, then the selector used by load(...) will never be used and hence the load(...) function will also return elements that were in the loaded HTML documents head (such as meta, script, etc).
The effect of this bug is that you cannot load the body elements of an HTML document. The workaround is to include a div with an id around all the content that you want to load and select the content of that, i.e. load("http://my/url div#myid > *").
At least the documentation of load(...) should be corrected to reflect what will actually happen.
Attachments (0)
Change History (1)
Changed June 15, 2010 03:12AM UTC by comment:1
resolution: | → fixed |
---|---|
status: | new → closed |
Hopefully I've clarified the documentation.