views:

93

answers:

2

I have a bookmarklet storing a lot of DOM data, but I would love to avoid to put them out of the body tag so the script in the page won't mess with it.

Semantic value is not an issue for once, but I would like to know :

  • will it trigger some browser behaviour ?
  • will it still be accessible in the DOM ?
  • can I display it using absolute positionning or should I move it to the body every time ?
+4  A: 

Everything inside the <html> tag (even if outside the <body> tag) can be accessed via document.documentElement.

Eli Grey
Great. But can it be displayed using absolute positiong, or will it result with unpredictable behaviors accross browsers. I am asking before testing because I am on a linux machine and for now, can't test in 10 different browsers to check.
e-satis
If you're not producing a valid document, then behaviour across browsers is by definition undefined. Best to find a solution that's valid
Gareth
A: 

Result of some little testing :

  • Firefox won't display a big red DIV if it's after </body>
  • Firefox won't run alert() from a SCRIPT if it's after </body>
  • Firebug don't see them but display the famous Firebug DIV after </body>
e-satis