jquery/jquery-mobile — Issue #2770: getInheritedTheme may fail on certain classnames
Author: ronchalant
Created: 2011-10-20 18:46:20+00:00
State: open

There is a hole in the logic of the getInheritedTheme of jquerymobile core where the selector will select on anything matching "ui-(bar|body)-*" but the regular expression pattern assumes it can extract something matching "ui-(bar|body)-[a-z]\b".

I'm not certain whether multiple-character theme names are expressly forbidden, but the logic would also fail if it found a class name such as "ui-bar-a-myclass".

Basically the selector can result in false-positive matches while the regular expression assumes there will definitely be something matching "ui-(bar|body)-[a-z]\b"

Here's the Chrome dump (this is because my theme had multiple characters):
https://forum.jquery.com/topic/problem-with-getinheritedtheme-implementation

Here's a fix that will keep intact the single-character requirement:
https://github.com/ronchalant/jquery-mobile/commit/85d840b7b0ca8bd536520c421971aa0948cd8aaa

If the single-character theme name isn't a strict requirement (?) we just need to adjust the ([a-z])\b portion to read ([a-z]+)\b