Opened 16 years ago
Closed 16 years ago
#443 closed enhancement (invalid)
SPAM
Reported by: | joern | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | core | Version: | 1.1a |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description (last modified by )
Take this example:
html = "<ul><li>...</li></ul>"; html = $(html).find("li").css("color", "red").html();
It should be possible to write this as:
html = $("li", html).css("color", "red").html();
Change History (9)
comment:1 Changed 16 years ago by
comment:2 Changed 16 years ago by
Well, I would change this behaviour:
$('li'). css("color","red") changes the DOM tree automatically
$('li',html).css("color","red") should also change the html-code automatically.
comment:3 Changed 16 years ago by
I need some clarification on the semantics. In $("li", html) only the li elements are selected, right? So (with Johan's correction) there is a ul parent that binds them all and can be reached through parent() in later chained methods. What about the situation where the html fragment defines multiple sibling nodes that have no parent, and the selector doesn't grab them all?
html = "<p>test</p><div>one</div><p>two</p><p>three</p>" $("div", html);
It seems like an html string with a single root context node is probably easy to implement by running it through jQuery.clean. But I am not sure what is supposed to happen when there are multiple nodes in the context.
comment:4 Changed 16 years ago by
$('li',html).css("color","red") should also change the html-code automatically.
Strings are immutable in javascript, therefore the html-code must be retrieved if needed.
Dave: It doesn't work.
comment:5 Changed 16 years ago by
Description: | modified (diff) |
---|
comment:6 Changed 16 years ago by
Status: | new → reopened |
---|
comment:7 Changed 16 years ago by
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
comment:8 Changed 16 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
comment:9 Changed 16 years ago by
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
Summary: | Accept html markup as context paramter to jQuery constructor → SPAM |
Good point, you'd want to correct the html example just to be clear though. ( html = "<ul><li>...</li></ul>"; )