CSS not picked up when not inline on element

137 views
Skip to first unread message

Emil Stenström

unread,
Jun 18, 2013, 7:56:11 AM6/18/13
to zomb...@googlegroups.com
Hi,

I've tried for two days now and can't find a way to inspect css attributes from an external file or inline in head (as in the example). Here's a reduced test case of what I was expecting would work:
https://gist.github.com/EmilStenstrom/5804732

Anyone mind enlightening me why I don't get access to the "color: green" rules?

I'm using zom...@2.0.0-alpha19.

(The reason I want checks like this is because I'm testing a jQuery Mobile app, and there the only thing that happens when someone clicks is a style change (display: none))

Assaf Arkin

unread,
Jun 18, 2013, 11:38:27 AM6/18/13
to zomb...@googlegroups.com
You can check if jQuery changed the display style. You just won't see the default value from the CSS.
--
You received this message because you are subscribed to the Google Groups "zombie.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zombie-js+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Emil Stenström

unread,
Jun 18, 2013, 11:56:46 AM6/18/13
to zomb...@googlegroups.com
Do I understand your answer correctly if I assume that zombie.js doesn't
actually parse the CSS and apply it to the correct elements?

In that case, why is there a loadCSS option?

/E

Assaf Arkin skrev 2013-06-18 5:38 PM:
> You can check if jQuery changed the display style. You just won't see
> the default value from the CSS.
>
> On Tuesday, June 18, 2013 at 4:56 AM, Emil Stenstr�m wrote:
>
>> Hi,
>>
>> I've tried for two days now and can't find a way to inspect css
>> attributes from an external file or inline in head (as in the
>> example). Here's a reduced test case of what I was expecting would work:
>> https://gist.github.com/EmilStenstrom/5804732
>>
>> Anyone mind enlightening me why I don't get access to the "color:
>> green" rules?
>>
>> I'm using zom...@2.0.0-alpha19 <mailto:zom...@2.0.0-alpha19>.
>>
>> (The reason I want checks like this is because I'm testing a jQuery
>> Mobile app, and there the only thing that happens when someone clicks
>> is a style change (display: none))
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "zombie.js" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> an email to zombie-js+...@googlegroups.com
>> <mailto:zombie-js+...@googlegroups.com>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "zombie.js" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/zombie-js/mz0dy3qcplo/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to

Assaf Arkin

unread,
Jun 18, 2013, 2:03:57 PM6/18/13
to zomb...@googlegroups.com, zomb...@googlegroups.com
It is parsed and if you use the CSS DOM API you should be able to access and introspect stylesheets and rules.

​Element style properties do not pickup their styles from the CSS.


To unsubscribe from this group and stop receiving emails from it, send an email to zombie-js+...@googlegroups.com.

Emil Stenström

unread,
Jun 18, 2013, 2:17:16 PM6/18/13
to zomb...@googlegroups.com
I see. This would be an excellent addition to zombie.js in my opinion.

Thanks for your replies, I'll go with the slower option (PhantomJS) instead.

/E

Tom Hosford

unread,
Sep 25, 2013, 3:36:39 PM9/25/13
to zomb...@googlegroups.com
Assaf, 

Thanks for this project.  Can you elaborate on how one would introspect stylesheets and rules?  I don't understand the purpose of loadCSS if elements don't have the CSS applied to them.

This is generally only a problem when testing visibility.  For instance if a class on a DOM element or parent element is changed, which causes a new CSS rule to be applied and render the element display:none, there is no way to test that visibility that I see with Zombie.

Tom

Assaf Arkin

unread,
Sep 25, 2013, 3:40:13 PM9/25/13
to zomb...@googlegroups.com
Zombie is about testing your application behavior: did it apply the given class to the element or not.

It doesn't test what actually gets rendered to the end user. For that you'll need to test in actual browsers.
Reply all
Reply to author
Forward
0 new messages