adobe-webplatform / dropcap.js

Beautiful CSS drop caps made easy
Other
929 stars 70 forks source link

Use -initial-letter if it is available #1

Open grorg opened 10 years ago

grorg commented 10 years ago

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.

sylvain-galineau commented 9 years ago

Good idea. Added to the list!

sylvain-galineau commented 9 years ago

Update!

I have added support for A through the Dropcap.options.runEvenIfInitialLetterExists property (defaults to true)

Regarding B: