tmpvar / weld

Template antimatter for Node.js (Browsers too!)
673 stars 39 forks source link

update href properties of anchors #31

Closed ironchefpython closed 13 years ago

ironchefpython commented 13 years ago

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.

tmpvar commented 13 years ago

while I agree that putting data into attributes is really important, this patch fixes one issue by creating another.

ironchefpython commented 13 years ago

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 ,