In a HTML5/JS application we have a view with some styles depending on the data-attribute
of elements:
like
<li data-level="0"></li>
or
<li data-level="1"></li>
CSS
li[data-level^="1"] {
/* some styles */
}
This seems to work just fine everywhere on page reload
.
But when the data-attribute get set programmatically via JS, the CSS properties get rendered in all relevant desktop browsers, but not in mobile safari.
JS part looks like this:
this.$el.attr('data-level', this.model.getLevel())
Any ideas on how to force to apply those properties (refresh/repaint something) ?
I would like to avoid using the class attribute and different classes as things are more complex than shown here...