You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's assume you can do this: window.CSS && window.CSS.supports("-webkit-initial-letter", "1");
I suggest you need two flags:
A. onlyExecuteIfNativeIsMissing (or something like that) where the JS will early return if the test above returned false. This would allow an author to write CSS rules that use initial-letter as well as include dropcap.js and not have them conflict.
B. preferNativeImplementation where dropcap.js would use initial-letter rather than setting the styles on the objects. This is actually quite annoying to do thanks to the 💩 that is the CSS OM, where you can't create a pseudo-style directly, but you have to create a whole new style rule, etc.
The text was updated successfully, but these errors were encountered:
I have added support for A through the Dropcap.options.runEvenIfInitialLetterExists property (defaults to true)
Regarding B:
As you point out, generating additional CSSOM rules is painful. Not so much creating additional rules but generating selectors is a bit awkward. One relatively easy way to support this would be to allow the caller to pass in a querySelector string instead of an HTMLElement or NodeList; when they do that we'd support preferNativeImplementation. It's not great but it's a start.
But once I do the above I'll run into a wrinkle with WebKit Nightlies: the spec has swapped the order of the parameters so I'd sometimes get the wrong result in WK using a valid value. I think I'll try to submit a patch for this, then maybe hack this into dropcap.js...
First!!
Let's assume you can do this: window.CSS && window.CSS.supports("-webkit-initial-letter", "1");
I suggest you need two flags:
A. onlyExecuteIfNativeIsMissing (or something like that) where the JS will early return if the test above returned false. This would allow an author to write CSS rules that use initial-letter as well as include dropcap.js and not have them conflict.
B. preferNativeImplementation where dropcap.js would use initial-letter rather than setting the styles on the objects. This is actually quite annoying to do thanks to the 💩 that is the CSS OM, where you can't create a pseudo-style directly, but you have to create a whole new style rule, etc.
The text was updated successfully, but these errors were encountered: