Question on ConditionalProperties

23 views
Skip to first unread message

FKereki

unread,
Nov 15, 2012, 6:02:05 PM11/15/12
to google-we...@googlegroups.com
Hi!

I was just checking the Wiki page on Conditional Properties, and I think an example is off by one.

Given:

<define-property name="mobile.user.agent" values="android, iphone, not_mobile" />
<property-provider name="mobile.user.agent"><![CDATA[
  {
    var ua = window.navigator.userAgent.toLowerCase();
    if (ua.indexOf('android') != -1) { return 'android'; }
    if (ua.indexOf('iphone') != -1) { return 'iphone'; }
    return 'not_mobile';
  }
]]>
</property-provider>

<!-- Constrain the value for non-webkit browsers -->
<set-property name="mobile.user.agent" value="not_mobile" >
 
<none> <!-- Actually means NOR, in this case "not safari" -->
   
<when-property-is name="user.agent" value="safari" />
 
</none>
</set-property>


the text says "instead of having [user.agent] * [mobile.user.agent] = 6 * 3 = 18 permutations, this will produce [user.agent] + [mobile.user.agent] = 9 permutations."

As I see it, five of the possible user.agent values (i.e., everything but Safari) will each produce a combination (for mobile.user.agent="not_mobile"), and when user.agent is Safari, it will produce three combinations, for each mobile.user.agent value -- and that comes out to 8, not 9. Am I missing anything?


Reply all
Reply to author
Forward
0 new messages