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

       Web browser: ---
             Bug #: 30998
           Summary: Improve JavaScript manipulation
           Product: MediaWiki extensions
           Version: any
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: Unprioritized
         Component: BookManager
        AssignedTo: raylton.so...@gmail.com
        ReportedBy: mybugs.m...@gmail.com
            Blocks: 28011
    Classification: Unclassified


Copying from r84906#code-comments,

Since the script at bookmanager.js interacts with the DOM, it should be
executed only when document is ready, as in:
$(function() {
    //Code goes here...
});

Besides, I think you should replace
 if ( $prev[0] ) by if ($prev.length)
 if ( $next[0] ) by if ($next.length)

And if would be good idea to add an id for the top navigation and another for
the botton, so that $( ' .mw-book-navigation ' ) can be replaced by something
like
$( '#some-id-for-top, #some-id-for-bottom' ).find( ' .mw-book-navigation ' )
, which is more efficient. See
[[mw:JavaScript_performance#Selector_performance_.28jQuery.29]]

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- 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