Last modified: 2011-02-23 08:18:38 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 T27322, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 25322 - Possible issue with addOnloadHook in wikibits
Possible issue with addOnloadHook in wikibits
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
ResourceLoader (Other open bugs)
1.17.x
All All
: Normal enhancement (vote)
: ---
Assigned To: Trevor Parscal
:
Depends on:
Blocks: 24415
  Show dependency treegraph
 
Reported: 2010-09-26 14:11 UTC by Jeroen De Dauw
Modified: 2011-02-23 08:18 UTC (History)
2 users (show)

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


Attachments

Description Jeroen De Dauw 2010-09-26 14:11:05 UTC
I'm adding some inline JS to the page head section, which uses the addOnloadHook function from wikibits. After the inclusion of wikibits moved to the resource loader, this broke - addOnloadHook is not available at the point where I'm using it. This is breaking all maps in the Maps and Semantic Maps extensions.

An example of the JS that is breaking: http://dpaste.org/uB7Q/

How should I modify my code, or is this a bug in the resource loader?
Comment 1 Roan Kattouw 2010-09-27 08:39:36 UTC
Exactly how are you adding the JS to the page? Adding JS inline (that is, at arbitrary locations in the <body>) is no longer supported. Instead, use $wgOut->addScript() or $wgOut->addScriptFile(). This previously used to put scripts in the <head>, but will now put them in the location where the resource loader expects them. Of course, porting your extension(s) to use the resource loader would be even nicer (but kills 1.16 compat).
Comment 2 Jeroen De Dauw 2010-09-27 09:00:21 UTC
PHP: http://dpaste.org/O2Eh/

Using $wgOut->addScript() instead seems to work fine at first try. IIRC, there was a reason for not using this though, as it didn't work correctly in all contexts. Unfortunately I can't remember the details.

I'll look into making Maps and Semantic Maps use the resource loader as soon as there is decent documentation.
Comment 3 Trevor Parscal 2010-09-27 20:14:39 UTC
Can this be closed then? It sounds like this was just unsupported behavior not a bug.
Comment 4 Roan Kattouw 2010-09-27 20:17:52 UTC
(In reply to comment #3)
> Can this be closed then? It sounds like this was just unsupported behavior not
> a bug.
It's unsupported behavior that I think should be supported in some way. Not sure which yet. Let's talk about this tomorrow.
Comment 5 Krinkle 2010-12-09 20:19:07 UTC
(In reply to comment #4)

What was the outcome  ?
Comment 6 Roan Kattouw 2011-02-22 21:19:56 UTC
(In reply to comment #5)
> (In reply to comment #4)
> 
> What was the outcome  ?

I don't remember, but I think we can close this one.

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


Navigation
Links