Comments (4)
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:
I would say this is a bug in both browsers, although clearly more problematic in FF.
from rangefix.
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:
from rangefix.
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.
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)
- Some client rects are redundant HOT 2
- Selections not returned in correct DOM order HOT 10
- Bounding rect incorrect when selecting space spanning lines
- Some client rects appear twice HOT 3
- RangeFix.getClientRects(range) Not returning correct rects. HOT 5
- range.getBoundingClientRect() misbehaviour on multiline texts HOT 4
- issue in ios devices
- Investigate IE/Edge bi-di issue HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rangefix.