开发者

What are the issue with putting markup outside <body>?

开发者 https://www.devze.com 2022-12-08 00:56 出处:网络
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.

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 D开发者_如何转开发OM ?
  • can I display it using absolute positionning or should I move it to the body every time ?


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


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消