Comments (14)
By the way, I should add that this is on Chrome - it works fine on Firefox.
from imscjs.
It looks like this is a symptom of a bug in Chrome, which does not suppress white-space at the end of lines. As a result, the newline before the <br>
is turned into a space, which is wrapped in an anonymous span with a transparent background. It is the latter to which line padding is applied.
from imscjs.
I understand, that certainly is unfortunate. Would you consider adding a workaround to "force" correct white space removal?
If you use jquery, something like the .trim()
feature applied to each line might work, for example.
from imscjs.
Is there a crbug ticket for this issue?
from imscjs.
If you use jquery, something like the .trim() feature applied to each line might work, for example.
It is more complicated:
- hiding the spaces can only happen after the line breaks are determined through inspection (since lines can wrap)
- hiding the spaces can impact line wrap (in Chrome and Edge due to the bug)
... so this will need to be incorporated in the linePadding/multiRowAlign algorithm.
What would you day is the relative importance of this issue?
from imscjs.
@bbcrddave The thread at https://lists.w3.org/Archives/Public/www-style/2016Aug/0057.html implies that bugs would/should/could be filed.
from imscjs.
What would you day is the relative importance of this issue?
This is a tricky question to answer: relative to what? I would say that if linePadding is to be supported then it needs to be correctly supported, and it is something that I expect will be used.
Regarding the spaces impacting line wrap, if you know where the line wrap has been placed and that there is no manual break in the content, presumably you could in the script insert a <br/>
so that any space trimming no longer affects the line breaks? And then trim trailing spaces.
from imscjs.
if you know where the line wrap has been placed and that there is no manual break in the content,
presumably you could in the script insert a
so that any space trimming no longer affects the line breaks?
Yes, as long as removing the offending whitespace in Chrome would have not caused lines to re-wrap, at which point the explicit <br/>
are no longer accurate.
The linePadding algorithm, which inserts explicit <br/>
accounting for the extra space taken by the padding, can likely be modified to address this Chrome bug. Modification of this algorithm however needs to be done carefully so that linePadding and multiRowAlign remain unaffected.
My plan is to first setup a robust test suite (see #29) and then address this kind of issues (with the safety net of a test suite to catch regression bugs) -- so the more tests the better at this point!
from imscjs.
Has there been any progress on this issue? I tried with Canary (60) and it is still a problem 😢
from imscjs.
@bbcrddave Yes, #29 has been closed, so we can hopefully make progress on this one. Do you have a set of canonical linePadding/multiRowAlign tests that you use?
from imscjs.
@bbcrddave Something that could be done in the short-term is remove all whitespace before all explicit <br>
before processing multiRowAlign and linePadding. It might not address all corner cases, but would address the test case above. Thoughts?
from imscjs.
I haven't looked too hard at what it would take to create a bunch of canonical tests for this but they wouldn't really be about linePadding or multiRowAlign in themselves: rather they would be about the treatment of white space, since from #27 (comment) we can see that it is the presence of white space in particular locations that triggers the issue.
from imscjs.
@bbcrddave The PR at #40 should correct this defect by pruning all whitespaces immediately before and after explicit br
elements. Looking forward to your review.
from imscjs.
Apologies for the slow response.
The proposed change solves the issue in Chrome and still works in Firefox - thanks!
from imscjs.
Related Issues (20)
- For .. in loops not protected from iterating prototype properties HOT 14
- Upgrade to use es6 language features? HOT 1
- `Set()` has a name clash with the ES6 `Set` object HOT 1
- Multiple referenced generic font family names can result in duplicate font-family values
- Error parsing fontSize with two lengths HOT 2
- Improve performance with a large number of regions and ISDs
- Unable to specify rgba color values for tts:textShadow HOT 1
- elementBoundingRect needs to be declared a `var`
- Update timeBase attribute to accept full list of values HOT 6
- adjacent tts:textCombine spans are combined into a single span HOT 3
- HTML rb, rtc and rbc elements are deprecated HOT 2
- if a line starts/ends with a ruby definition, line padding is not applied
- SMPTE timecode parsed incorrectly (23.976 FPS) HOT 1
- Resolve images source while generating ISD HOT 18
- Replace the XML SAX parser with a DOM parser HOT 6
- Spaces in `tts:fontFamily` list not handled in HTMLStylingMapDefinition code HOT 1
- Firefox bug with negative margins HOT 1
- FontFamily `default` name mapping missing HOT 7
- fillLineGap doesn't always fill the gap HOT 11
- Uncaught (in promise) TypeError: Cannot set properties of undefined (setting 'imscISD') HOT 4
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 imscjs.