Skip to content

Instantly share code, notes, and snippets.

@creeperyang
Created June 13, 2015 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save creeperyang/0600e7f42975641f8d75 to your computer and use it in GitHub Desktop.
Save creeperyang/0600e7f42975641f8d75 to your computer and use it in GitHub Desktop.
你真的了解原生 dom 选择器吗?

live nodelist?

  1. 只有element/document.getElementsByClassName element/document.getElementsByTagName document.getElementsByName 获取返回的才是 live HTMLCollection of found elements.
  2. querySelectorAll 等获取的是 static nodelist.

所以像操作dom发生时,尤其当心你是否获取了想要的nodelist。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment