In my tests, i create some document fragment with jQuery like:
el = $("<span>hello world</span>")
Then i make some manipulation with this fragment and want to detect, if element will change its sizes (specially want to detect, if there is a newline). Is there any way, how to detect it without placing fragment into document?
Would love to have something like:
el.height() // -> 20
Thanks.
Until you add
elto the DOM, theelhas no height.However you can get the height by append it to DOM, like
el.hide().appendTo($('body')).height()Here is the demo.