久久久久久久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 似乎不起作用的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

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.

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

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

相關文檔推薦

CSS selector when :target empty(:target 為空時的 CSS 選擇器)
Does the CSS direct decendant (gt;) not have any value in selectivity?(CSS 直接后代 (gt;) 在選擇性方面沒有任何價值嗎?)
Using querySelectorAll(). Is the result returned by the method ordered?(使用 querySelectorAll().方法返回的結果是否有序?)
Safari bug :first-child doesn#39;t update display:block when items are removed with JS(Safari 錯誤:當使用 JS 刪除項目時,first-child 不更新 display:block)
nth-Child CSS selectors(nth-子 CSS 選擇器)
Using same ID for multiple HTML tags?(對多個 HTML 標簽使用相同的 ID?)
主站蜘蛛池模板: 男人的天堂在线 | 可以看的毛片 | 午夜黄色影院 | 成人高潮片免费网站 | 人人射人人 | 自拍偷拍av | 亚洲国产中文字幕 | 成人免费在线播放 | 超碰在线国产 | 黄色大片在线 | 91免费视频| 一区二区在线免费观看 | 黄色国产在线观看 | 日本不卡免费 | 国产精品欧美日韩 | 精品在线免费视频 | 99久久久| 久草福利在线视频 | 国产视频在线观看视频 | 欧美特黄视频 | 成人看片网 | 韩国理论在线 | 久久天天躁狠狠躁夜夜躁2014 | 少妇性bbb搡bbb爽爽爽欧美 | 久久久久久久久久久国产 | www.日日日 | 日韩专区在线观看 | 久久999 | 成人免费视频国产免费 | 亚洲高清毛片一区二区 | 国产美女自拍 | 欧美一区二区三 | 成人免费视频一区二区 | 日本不卡高字幕在线2019 | 亚洲成人黄色 | 欧美日韩在线精品 | 男人影院在线观看 | 国产精品一品二区三区的使用体验 | 天天干女人| 在线黄色av | 久久99热这里只频精品6学生 |