https://bugzilla.wikimedia.org/show_bug.cgi?id=62762

--- Comment #4 from Krinkle <krinklem...@gmail.com> ---
> (In reply to James Forrester from comment #1)
> > Tony, are you planning to take on this bug?
> 
> I plan to. But is there anything like bind() is only present in modern
> browsers ?

Indeed, Function.prototype.bind is new in ECMAScript 5, which VisualEditor
requires. Or rather, VE requires ECMAScript 3 syntax engine and an environment
that somehow provides certain ES5 features, which can potentially be
polyfilled. We don't yet (and that is by design), adopt any ES5 syntax or ES5
features that can't be polyfilled.

This is already guarded against using the feature test in our mw integration
init[1], so you can rely on this without having to worry about old browsers.

(In reply to Roan Kattouw from comment #3)

I'd recommend #2 for consistency (we do the same with other ES5 features we've
adopted) and minor performance micro optimisation (extra global and property,
extra callstack because it has to be a proxy calling bind, unlike Array.isArray
is can't be assigned to ve.bind by reference because bind needs to be bound
itself) and because we're already using '.bind' in a few places.

But keeping ve.bind with a small wrapper to bind using bind seems fine for
backwards compatibility with ve plugins in the wild. But I'd recommend we don't
use this in core.

[1]
https://github.com/wikimedia/mediawiki-extensions-VisualEditor/blob/7e52a1ab2ab514/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js#L74-L93

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to