Andy E

United Kingdom

whattheheadsaid.com

Age: 31

I'm mainly a JavaScript coder, with some experience in other languages.

If I helped you a lot, dontations are welcome via GitTip, but just a thanks, an up vote or the green check is enough :-)

10h
awarded Nice Answer
10h
awarded Enlightened
Aug
15
comment how to validate credit card number
@Steve: it sure is, that's why I did note it at the bottom of my answer ;-)
Aug
14
comment Is there a way to detect if a browser window is not currently active?
@Heliodor: I'd like to keep the code in the answer minimal for now. It was never intended to be a cut-and-paste complete solution, as implementors might want to avoid setting a class on the body and take a completely different action altogether (such as stopping and starting a timer).
Aug
14
comment How should user agents handle unrecognized HTML elements?
@vol7ron: Another interesting point is that Anne van Kesteren's main reason for dismissing them as a bad idea was the potential naming collisions. The specs outlining the addition of custom elements force you to use at least one hyphen in the name, which ensures no possible future naming collisions (presumably because all future standardised elements will never have a hyphen). So, it's not so much a bad idea anymore, although consideration will need to be given. I believe there's a shim for the Web Components API, too, which might simplify creating your own elements.
Aug
13
comment How should user agents handle unrecognized HTML elements?
@vol7ron: custom elements now have their own specification, albeit in Working Draft status. The idea is that custom tag names with a hyphen are valid custom elements. If they don't have the hyphen, they retain HTMLUnknownElement as the prototype. Browser support is very limited at the moment, though. I haven't heard anything about custom elements sending browsers into quirksmode, so if you want to use them, then go ahead :-).
Aug
13
revised Get the window height
added 12 characters in body
Aug
6
awarded Revival
Aug
1
comment JavaScript find element by text
+1 with a sidenote that getElementsByTagName is faster than querySelectorAll, and also that you can just call Array.prototype.filter.call(collection, filterElements), making the call to slice() redundant.
Aug
1
revised JavaScript find element by text
added 2 characters in body
Jul
31
awarded Good Answer
Jul
31
awarded Autobiographer
Jul
30
awarded Great Answer
Jul
18
awarded Autobiographer
Jul
11
comment Is right click a Javascript event?
@Joe: funny how that went 32 up votes and 4 years without anyone noticing ;-) I think I can be excused, though - it was 00:30am when I wrote the answer!
Jul
11
revised Is right click a Javascript event?
edited body
Jul
9
comment How to remove the hash from window.location with JavaScript without page refresh?
@dayuloli: updated, thanks :-)
Jul
9
revised How to remove the hash from window.location with JavaScript without page refresh?
added 1 character in body
Jul
7
awarded Guru
Jul
4
comment Retrieve the position (X,Y) of an HTML element
@CpnCrunch: I see what you mean now; I didn't realise you were referring to the latter part of my answer. When the body has a margin, its bounding box will be offset by that number of pixels at each respective side. In that case, you'd also have to subtract the computed margin style from the body coordinates. It's worth noting that CSS resets remove the margin from <body>, though.
1 2 3 4 5