Code Monkey home page Code Monkey logo

Comments (2)

annevk avatar annevk commented on August 28, 2024

Tests would be good to verify that's indeed Chromium's behavior. I think WebKit would be okay with attempting to align with that, yes.

from quirks.

emilio avatar emilio commented on August 28, 2024

Here's a test-case. One quirk here is that at least Blink and Gecko parse *:hover and :hover to exactly the same thing. So ignoring that * special-case, yes, I think the chromium behavior is as I described above (for simple selectors at least). Not sure what the is_sub_selector in chromium conveys, it seems a mix of "being used for pseudo-elements" and "being in a nested pseudo-class / slotted / etc thing".

<!doctype html>
<body>
<script>
  let selectors = [
    `*:hover`,
    `:hover`,
    `span:hover`,
    `:is(a, span):hover`,
    `:is(span):hover`,
    `:not(div):hover`,
    `[data-attr]:hover`,
    `:hover:nth-child(1)`,
    `:hover:first-child`,
  ];

  for (let selector of selectors) {
    let frame = document.createElement("iframe");
    frame.src = `data:text/html,` + encodeURIComponent(`
      <style>${selector} { background-color: rgba(0, 0, 0, .2) }</style>
      <div id=root>
        <p><strong>${selector}</strong>
        <p><a data-attr href="#">Link</a>
        <p><span data-attr>Non-link</span>
      </div>
    `);
    document.body.appendChild(frame);
  }
</script>

from quirks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.