久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 Chrome 中嵌套 nth-child 的 querySelector 似乎不起作

querySelector with nested nth-child in Chrome doesn#39;t appear to work(在 Chrome 中嵌套 nth-child 的 querySelector 似乎不起作用)
本文介紹了在 Chrome 中嵌套 nth-child 的 querySelector 似乎不起作用的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

I've been looking at using nth-child within an nth-child selector to find an element. This appears to work in Firefox, but does not seem to be working on chrome. Here's my test file:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>untitled</title>
    <!--[if IE]>
        <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <script type="text/javascript" charset="utf-8">
        myFunc = function() {
            if(document.querySelector('#wonderful DIV:nth-child(2) DIV:nth-child(2)')) {
                alert("found the element");
            } else {
                alert("element not found");
            }
        };
    </script>
</head>
<body onLoad="myFunc()">

    <div id="wonderful">
       <div>
       </div>
       <div >
           <div>
           </div>
           <div class="blue">
               find me!
           </div>
       </div>
    </div>

</body>
</html>

Has anyone else seen this issue? Have a solution to get around this?

解決方案

This worked for me in chrome, but it does not work in FF then.

document.querySelector('#wonderful div:nth-child(2):nth-child(2)')

The following snipped works in both browsers, but I assume you know that already

document.querySelector('#wonderful div:nth-child(2) div.blue')

So it looks like an implementation failure in chrome for me.

這篇關(guān)于在 Chrome 中嵌套 nth-child 的 querySelector 似乎不起作用的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

CSS selector when :target empty(:target 為空時(shí)的 CSS 選擇器)
Does the CSS direct decendant (gt;) not have any value in selectivity?(CSS 直接后代 (gt;) 在選擇性方面沒有任何價(jià)值嗎?)
Using querySelectorAll(). Is the result returned by the method ordered?(使用 querySelectorAll().方法返回的結(jié)果是否有序?)
Safari bug :first-child doesn#39;t update display:block when items are removed with JS(Safari 錯(cuò)誤:當(dāng)使用 JS 刪除項(xiàng)目時(shí),first-child 不更新 display:block)
nth-Child CSS selectors(nth-子 CSS 選擇器)
Using same ID for multiple HTML tags?(對(duì)多個(gè) HTML 標(biāo)簽使用相同的 ID?)
主站蜘蛛池模板: 日韩精品av一区二区三区 | 综合久久亚洲 | 免费一区二区三区 | jizz在线看片 | 亚洲精品电影网在线观看 | 久久综合激情 | 国产99久久久国产精品下药 | 一区欧美 | 欧美成人在线免费 | 国产98色在线 | 日韩 | 91精品综合久久久久久五月天 | 欧美日韩精品免费观看 | 欧美aaa一级片 | 国产高清精品一区二区三区 | 成年人黄色小视频 | 亚洲一区二区精品视频 | 日韩1区 | 日韩视频在线一区 | 精品久久久一区二区 | 一级毛片在线播放 | 久久精品中文 | 亚洲a级 | 日韩在线观看网站 | 三级成人在线观看 | 九一视频在线播放 | 国产精品久久在线观看 | 国产精选一区 | 久久久人成影片一区二区三区 | 99精品久久久久久久 | 91不卡| 综合久久一区 | 精品亚洲一区二区三区四区五区 | 欧美在线观看一区 | 中午字幕在线观看 | 中文字幕精品一区 | 久草网站 | k8久久久一区二区三区 | 国产三级 | 亚洲欧美视频 | 人人干人人干人人干 | 欧美电影免费网站 |