Commit:    ca725c7e2dd7a44355f3b3d2fc9015257dea0fef
Author:    Levi Morrison <le...@php.net>         Wed, 24 Jul 2013 11:04:33 -0600
Parents:   4112cc844045146810ca14df93fd06017b650491
Branches:  responsive

Link:       
http://git.php.net/?p=web/php.git;a=commitdiff;h=ca725c7e2dd7a44355f3b3d2fc9015257dea0fef

Log:
Optimized jQuery searches

Changed paths:
  M  js/common.js


Diff:
diff --git a/js/common.js b/js/common.js
index e57a01d..2153f8a 100644
--- a/js/common.js
+++ b/js/common.js
@@ -131,14 +131,15 @@ $(document).ready(function() {
     });
 
     var $docs = $('.docs');
+    var $refsect1 = $docs.find('.refentry .refsect1');
     var $docsDivWithId = $docs.find('div[id]');
     $docsDivWithId.children("h1, h2, h3, h4").each(function(){
         $(this).append("<a class='genanchor' href='#" + 
$(this).parent().attr("id") + "'> ΒΆ</a>");
     });
     var scrollHeightOfHeadnav = - 
document.getElementById('head-nav').scrollHeight;
     scrollHeightOfHeadnav -= 12; //some margin
-    $parameters = $(".parameters .term .parameter");
-    $docs.find(".refsect1 .parameter").each(function () {
+    $parameters = $refsect1.filter(".parameters").find(".term .parameter");
+    $refsect1.find(".parameter").each(function () {
         var $node = $(this);
         var $nodeText = $node.text();
         if ($nodeText[0].charAt(0) === '$') {
@@ -219,7 +220,7 @@ $(document).ready(function() {
     });
     
     // We have <p> tags generated with nothing in them and it requires a PHD 
change, meanwhile this fixes it.
-    $('.docs .refentry .parameters p, .docs .refsect1.examples p, .docs 
.refsect1.seealso p').each(function() {
+    $refsect1.find('p').each(function() {
         var $this = $(this), html = $this.html();
         if(html !== null && html.replace(/\s|&nbsp;/g, '').length == 0) {
             $this.remove();


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to