On Thu, Dec 25, 2014 at 3:24 AM, S Page <spage(a)wikimedia.org> wrote:
[..]
*Other warnings*PageTriage is still warning:
JQMIGRATE: jQuery.fn.andSelf() replaced by jQuery.fn.addBack()
JQMIGRATE: jQuery.fn.attr('checked') may use property instead of
attribute
JQMIGRATE: $(html) HTML strings must start with '<' character
are any of these must-fixes? How will we be reminded to fix them if
jquery.migrate is turned off?
Ideally the jquery.migrate logging would have warned "Dude, this one's
coming from extension PageTriage', I guess that requires fragile AI to walk
the stack or DOM looking for the guilty party. I saw lots of JQMigrate
warnings in Firebug until it was removed, but it was hard to tell what code
was triggering the warning.
andSelf() has been deprecated but removal has not been announced yet
upstream. However we no longer support older jQuery versions (each
MediaWiki release ships one version, and that's the one it supports).
Nothing is stopping us from migrating calls to addBack().
attr('checked') is a must-fix. Browsers parse attributes html strings. The
values are stored in the Node tree attribute objects and can be mutated
there. However they are only used to to provide initial values of Node
properties. Properties represent live state, attributes do not (except for
e.g. css selectors, which apply to tree structure, not Node objects). Older
versions of jQuery did counter-intuitive trickery to sometimes return or
set values of properties instead of attributes. This has been removed in
favour of a .prop('checked') method.
$(html) is a must-fix. $() is a heavily overloaded method (supporting css
selector strings, among many other things). To avoid ambiguity and for
security reasons, it now only supports valid HTML that starts with a '<'
character. If you have other html strings (e.g. starting with text nodes),
use $.parseHTML() directly.
-- Krinkle