You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Well technically it refers to the interface Attr from W3C DOM Level 1. Also… there’s jQuery’s selection.attr method, but that’s more of a coincidence because D3 uses selection.style rather than selection.css.
But I can’t say whether this was truly intentional at the time, or if I was overly concerned about brevity. In general I prefer short words to abbreviations and acronyms, since the dropped letters are often arbitrary and difficult to guess. (For example, most UNIX commands.) Though you will find exceptions, like selection.attr and d3.xhr (which we agree should probably be named “request” instead, d3/d3-request#3)… and even the name “d3” itself!
If I thought about it too much, I’d probably be more inclined to rename it to selection.attribute and have selection.attr be the deprecated alias. But… I think it’s probably not worth making that change at this point, as “attr” is in wide usage.
Also, I like parsimony (and hence try to minimize aliases) so that code everywhere tends to be more consistent. If we introduce a selection.prop (or selection.attribute) alias, it’s one more thing for people to learn.
I assume that
selection.attr
isn't namedselection.attribute
for a reason.So why force everyone to write
.property
every time?The text was updated successfully, but these errors were encountered: