Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
joestelmach
· 14y ago · 0 comments
Many would frown upon polluting the global name space with functions corresponding to all known HTML tags.
Comments
[–]
tikhonj
14y ago
If you end up wrapping your code in an immediately called lambda anyhow I'm sure it would be fine.
[–]
mistercow
14y ago
Sort of, but there are some tags you probably don't want to pollute your own top-level namespace with, like a, b, i, object, p, q, and s. There's at least one tag (var) which is not allowed as an identifier on its own.
[–]
WiseWeasel
14y ago
I think 'a' and 'p' are the only ones among those you'd actually want. I could probably live with with those limitations.
[–]
WiseWeasel
14y ago
Now that I think about it, that might break a few sortFunction(a,b) {//do stuff with a and b} type functions of mine...
[–]
catch23
14y ago
You could use with(){} in js so you don't have to pollute your global namespace and still have pretty code.
[–]
mistercow
14y ago
Hardly seems worth it to invoke that confusing construct when you could just pack them in an object with a short name instead.