Code Monkey home page Code Monkey logo

Comments (4)

edg2s avatar edg2s commented on May 25, 2024

Thanks. It looks like with triple click on FF the range becomes [<p> ... </p>] (start/end node: p, offsets: [0,2]), whereas on Chrome, triple click stills selects inside text nodes: <p>[ ... ]</p>.

Setting this programmatically in Chrome gives incorrect rectangles:

image

I would say this is a bug in both browsers, although clearly more problematic in FF.

from rangefix.

edg2s avatar edg2s commented on May 25, 2024

The cause of this bug appears to be the display: inline-block <img> which is wrapped in an display: inline <u>. If i remove the inline wrapper, everything works fine in all browsers:

image

from rangefix.

edg2s avatar edg2s commented on May 25, 2024

Upstream bugs:
Chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=1147474
Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1676467

from rangefix.

edg2s avatar edg2s commented on May 25, 2024

According to a comment on the Firefox task, this is behaving according to specification:

So spec is in https://drafts.csswg.org/cssom-view-1/#dom-range-getclientrects:

For each element selected by the range, whose parent is not selected by the range, include the border areas returned by invoking getClientRects() on the element.

So it seems to me that if <u> is selected by the range completely, then we'd return an smaller rect than if it wasn't per the above definition (because when <u> is not fully selected, then we union the getClientRects() of the text and the image, instead of just returning the rects of the <u>). That seems unfortunate, though it's what the spec seems to call for.

from rangefix.

Related Issues (9)

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.