| | |
Why I hate the W3C
![]() |
So, I've got a nifty little recursive function that runs through a select box and all it's children looking for the selected element and removes it, if the parent element is empty then it removes that as well. However, the W3C decided when passing DOM that there are 12, count 'em, 12 different node types.
So my function works perfectly well until it tries to do it's job and crawls across an
This, of course, boggles my mind. So checking nodes for the number of child nodes results in a false positive on
I've fixed it by kludging the crap out of it when checking the nodeType as well as the node length but.. wow, how on earth is that even logical?
So my function works perfectly well until it tries to do it's job and crawls across an
option node, which as defined by DOM has a nodeType of 3 (text node). However, the brilliant engineers decided that TEXT NODES should have child nodes which mirror the text attribute, ie.,<option id="s3">Text is here</option>
DOM:
element.id = "s3"
element.text = "Text is here"
element.childNodes = ["Text is here"]
[0]
nodeType = 3
nodeValue = "Text is here"This, of course, boggles my mind. So checking nodes for the number of child nodes results in a false positive on
option type nodes causing the function to incorrectly call and put itself into an infinite loop crawling the same node.I've fixed it by kludging the crap out of it when checking the nodeType as well as the node length but.. wow, how on earth is that even logical?
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
![]() |
Similar Threads
- W3C Validation (HTML and CSS)
- Drop your opinions (IE Vs Firefox) (HTML and CSS)
- Getting problem in IE. (JavaScript / DHTML / AJAX)
- HELP with CSS/Javascript Drop down menu from Dynamic Drive (HTML and CSS)
- tag that shows hand on mouseover (JavaScript / DHTML / AJAX)
- DaniWeb (DaniWeb Community Feedback)
Other Threads in the IT Professionals' Lounge Forum
- Previous Thread: Linux boot messages
- Next Thread: To Degree or not to Degree - that is my question
| Thread Tools | Search this Thread |
Tag cloud for IT Professionals' Lounge
1gbit advertising advice amazon answers archive british broadband business businessprocesses career carrier censorship cern china cio collectiveintelligence connectivity consumer consumers corporateearnings css datatransfer debtcollectors dictionary digg digital ebay ecommerce email employment facebook food government grid high-definition hottub infodelivery infotech intel internet interview ipod isp japan kindle lhc library malware marketing mit moonfruit news onlineshopping php piracy piratebay pope porn program questions r&d religion remoteworking research retail schools security sex shopping simple skype smallbusiness smb sms socialmedia socialnetworking software softwareengineer spam speed startrek statistics stocks study stumbleupon survey technology touch-screen touchscreen training twitter uk vbulletin videoinprint voips web webdeveloper windows words






