Last modified: 2011-07-04 11:52:21 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T31703, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 29703 - Resource loader executes modules in non-global context
Resource loader executes modules in non-global context
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
ResourceLoader (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Trevor Parscal
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-04 11:25 UTC by Yair Rand
Modified: 2011-07-04 11:52 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Yair Rand 2011-07-04 11:25:47 UTC
All gadgets loaded by ResourceLoader are executed in a non-global context, causing all variables and functions declared with "var foo" or "function foo" to be local, and unusable outside that specific module.
Comment 1 Max Semenik 2011-07-04 11:52:21 UTC
This is a deliberate change to isolate the already-polluted global scope. If you need a specific variable to be truly global, instead of foo = 'bar' use window.foo = 'bar'.

If your gadget's JS is not ResourceLoader-compliant, don't mark it with [ResourceLoader].

See:
 * http://www.mediawiki.org/wiki/Extension:Gadgets#ResourceLoader_support
 * http://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links