https://bugzilla.wikimedia.org/show_bug.cgi?id=42928
Web browser: ---
Bug ID: 42928
Summary: mwEmbed "clutters" the global window scope
(JavaScript)
Product: MediaWiki extensions
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: TimedMediaHandler
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Mobile Platform: ---
Activation of mwEmbed at Wikimedia Commons leads to some bugs. Therefore, I
call it a regression. Writing this bug report presumely took me more time than
fixing the bug but if I don't get dev-access, it's not my problem.
Browsers: all.
OS: all.
Instead of adding one "EmbedPlayer"-object, it adds "EmbedPlayer.Attributes",
"EmbedPlayer.AttributionButton" and so on.
Cluttering the global scope is considered bad practise (
https://www.google.com/search?q=javascript+clutter+window+scope ) and accessing
global scope variables is slow.
Let's illustrate this issue in JavaScript:
// Currently it does:
window['EmbedPlayer.Attributes'] = { /* an object */ };
window['EmbedPlayer.AttributionButton'] = { /* an object */ };
// But it should
window.EmbedPlayer = {
Attributes: {
/* an object */
},
AttributionButton: {
/* an object */
}
};
// This would allow to "transfer" the variable to a local scope (actually
creating a new reference to window.EmbedPlayer) e.g.
function abc() {
var ep = window.EmbedPlayer;
if (ep.Attributes) // fast variable access because it is in local function
scope and also allows to use abbrevations
}
--
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l