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

       Web browser: ---
             Bug #: 31926
           Summary: Updating from addOnloadHook to jQuery(document).ready
                    breaks some scripts
           Product: MediaWiki
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: Javascript
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    Classification: Unclassified


According to [[mw:ResourceLoader/JavaScript Deprecations#wikibits.js]], the
function "addOnloadHook" is deprecated in favour of "jQuery(document).ready".

This change breaks some scripts.[1][2]

E.g.: consider a function to get the rows of the table present on
[[Special:Upload]]:
----
function test(){
    document.getElementById( 'mw-htmlform-description' ).rows
}
----

If it is executed by "addOnloadHook", it will return all the 6 rows, but if it
is executed by "jQuery(document).ready", it only returns 4 rows.

You can confirm this broken behavior using the sample code [3].

[1] https://pt.wikipedia.org/w/index.php?oldid=27372605
[2]
https://pt.wikipedia.org/wiki/MediaWiki_Discuss%C3%A3o:Gadget-UploadForm.js#Gadget_padr.C3.A3o_e_ResourceLoader
[3] https://en.wikipedia.org/?oldid=457179751

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to