Closed ironchefpython closed 13 years ago
while I agree that putting data into attributes is really important, this patch fixes one issue by creating another.
Fair enough. While I think there are certain types of html elements where the most common use case is where an attribute is updated instead of the element innerText, such as ,
I knew the patch was backward incompatible, but it seesm to me that going forward, the most natural idiom for update links is
$('<a id="target" href="link goes here"><span id="text">text goes here</span></a>')
.weld({target:'http://google.com', text: 'google'});
But I'll go back to the drawing board, and see if I can come up with an idiom that is more to your liking.
I jotted down some ideas here: https://gist.github.com/1056720/
I'd like your feedback on which you'd accept, singly, or in combination. (any combination can co-exist as idioms)
When using weld, it seems natural that if you're welding data to an anchor element, that you'd want to be able to update the target of a link when welding data to it. This patch is a modification that checks if the matched element is an achor, and if so, updates the href property.
This is a backward-incompatible change, and any uses of weld that currently use weld to update the text of an anchor element will break.
If the desired behavior is to update the text of an achor, using a span element inside an achor element allows you to change both the link text and the target.