With the example CSS:
.thing { height: auto }
and HTML:
<div class="thing">The quick brown fox jumps over a lazy dog.</div>
is it possible to detect that the height of .thing is set to 'auto'?
The following methods return values:
jQuery('.thing').height() // n
jQuery('.thing').css('height') // 'npx'
getComputedStyle(node).height // 'npx'
Is there any method that will tell me that the browser is calculating these values from 'auto'?
Yes there is a way, but it's not a funny one. What you have to do is:
styletags
and linked stylesheets.Then get the selectorText
for all cssRules
in all style tags
styletag.sheet.cssRules.selectorText
or for IE < 9
styletag.styleSheet.cssRules.selectorText
Get all of your elements parents id
, class
and tagName
to find out what possible ways for the tag to get the attribute.
cssRules
cssRules
at cssRules.style.width
if it is auto.or do it some reverse way and find all cssRules
with style.width == 'auto';
either way its not something easy to get without a lot of code
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With