We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
返回第一个匹配的的第一个元素,如果没有返回Null
eg: var body = document.querySelector('body'); var myDiv = document.querySelector('#myDiv'); var selected = document.querySelector('.selected'); var img = document.body.querySelector('img .button');
返回匹配的NodeLists.
eg: var ems = document.getElementById('myDiv').querySelectorAll('em'); var strongs = document.querySelectorAll('p strong');
Eelement类型新增的方法。接收css 选择符,如果调用元素与该选择符匹配,返回true,否则返回false 目前除IE6-IE8,Firefox/Chrome/Safari/Opera/IE 的最新版本均已实现,但方法都带上了各自的前缀.
function matchesSelector(element,selector){ if(element.matchesSelector){ return element.matchesSelector(selector); }else if(element.msMatchesSelector){ return element.msMatchesSelector(selector); }else if(element.mozMatchesSelector){ return element.mozMatchesSelector(selector); }else if(element.webkitMatchesSelector){ return element.webkitMatchesSelector(selector); }else{ ... } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
1.querySelector
返回第一个匹配的的第一个元素,如果没有返回Null
2.querySelectorAll
返回匹配的NodeLists.
3.matchesSelector
Eelement类型新增的方法。接收css 选择符,如果调用元素与该选择符匹配,返回true,否则返回false
目前除IE6-IE8,Firefox/Chrome/Safari/Opera/IE 的最新版本均已实现,但方法都带上了各自的前缀.
The text was updated successfully, but these errors were encountered: