Re: [css3-regions][css3-multicol] how to cutt up elements

Hey Johannes,

I just wanted to reply this is exactly what I'm ended up doing in the new 
CSS Regions polyfill [0]. I also used a similar process for IE. The relevant 
code is in [1] and [2], mainly. Feel free to extract it from the polyfill if 
it suits your needs.

Yes, I agree with you this is clearly suboptimal to rely on API that are not 
even standardized to perform these operations, but this is all we have for 
now. I don't despair we shall get "getFragments" on elements which will 
return a list of Fragment (a Fragment being a list of DOM Ranges which are 
rendered in the same fragment on the page). This can only be done properly 
once the CSS Breaking spec has reached a satisfactory standardization level, 
though, which is'nt the case yet.

Best regards,
François


[0] https://github.com/FremyCompany/css-regions-polyfill
[1] 
https://github.com/FremyCompany/css-regions-polyfill/blob/master/src/css-break.js
[2] 
https://github.com/FremyCompany/css-regions-polyfill/blob/master/src/css-regions.js#L235


> From: Johannes Wilm
> Sent: Tuesday, April 15, 2014 10:05 PM
> To: www-style list
> Subject: [css3-regions][css3-multicol] how to cutt up elements
> Hey,
> given that CSS Regions unfortunately have been (temporarily) removed from 
> Blink, I've been experimenting with what other options there are to cut op 
> content, but letting the browser do the actual cutting.
>
> The only solutions I have come up with is using multiple CSS columsn and 
> then to determine where one columns ends using 
> caretPositionFromPoint/caretRangeFromPoint, and then cutting using 
> range.extractContents to remove the parts that don't fit.
>
> I have recreated most of the options I had available in the old 
> pagination.js using this method in this test: 
> http://fiduswriter.github.io/simplePagination.js/simplePagination.html 
> (working in Chrome and Firefox if the browser is occupying the entire 
> screen).
>
> It is somewhat of a hack, because 
> caretPositionFromPoint/caretRangeFromPoint only works if one first scrolls 
> to the place where one uses it.
>
>
> So my question to you guys: Is this how you suggest one cuts up contents? 
> Is there no less hackish way envisioned for javascript to determine what 
> content belongs to one specific column? It seems like that would be quite 
> an important piece of information for many uses.
>
> -- 
>
> Johannes Wilm
> Fidus Writer
> http://www.fiduswriter.com 

Received on Thursday, 17 April 2014 15:44:07 UTC