发布此查询后,我在封面下进行了更深入的研究,并发现了一些有趣的事情。
Firstly, the jQuery > selector only returns child elements. In the case of the flip switch the element to be styled is actually a grandchild. So my code should have been
$.each($('.contel > * > span'),function(ndx,e){$(e).css('fontFamily','arial')});
since the grandchild in question that requires styling is actually a span element. But this is where things start getting curious
That line of code turns
<span class="ui-slider-label ui-slider-label-a ui-btn-active ui-btn-corner-all" role="img" style="width: 0%; ">On</span>
into
On
i.e. gives the element an inline styling.
If instead I define a class
.georgia{font-family:georgia !important}
the new code is
<span class="ui-slider-label ui-slider-label-a ui-btn-active ui-btn-corner-all georgia" role="img" style="width: 0%; ">On</span>
i.e. the elment gets a new class tagged on to it.
Contrary to what the jQuery Mobile documentation suggests this upstyles the element as expected, even without issuing a slider('refresh'). However, the css modification that gives the element additional inline styling does not.
It is not clear to me why this could be happening. Hopefully, there is someone out here who has a better understanding of CSS3 and jQuery who can shed some light on this?