Changeset 12827

Show
Ignore:
Timestamp:
03/03/08 03:36:23 (10 months ago)
Author:
alex
Message:

update core documentation for query, re-enable the query optimizer, update misc docs around the rest of dojo.js as well. Refs #5962. !strict

Location:
dojo/trunk/_base
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • dojo/trunk/_base/array.js

    r12798 r12827  
    2222                        // description: 
    2323                        //              For details on this method, see: 
    24                         //                      http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:indexOf 
     24                        //                      <http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:indexOf> 
    2525 
    2626                        var step = 1, end = array.length, i = (fromIndex||0); 
  • dojo/trunk/_base/html.js

    r12454 r12827  
    2525        //      id: String|DOMNode 
    2626        //              DOM id or DOM Node 
    27         //      doc: DocumentElement 
     27        //      doc: DocumentElement? 
    2828        //              Document to work in. Defaults to the current value of 
    2929        //              dojo.doc.  Can be used to retreive 
  • dojo/trunk/_base/query.js

    r12533 r12827  
    4848        var d = dojo; 
    4949        var childNodesName = dojo.isIE ? "children" : "childNodes"; 
     50        var caseSensitive = false; 
    5051 
    5152        var getQueryParts = function(query){ 
     
    255256                        var prefix; 
    256257                        var postfix = ""; 
    257                         // FIXME: need to add support for ~ and + 
    258258                        if(tqp.oper == ">"){ 
    259259                                prefix = "/"; 
     
    317317 
    318318                var doc = d.doc; 
    319                 // var parent = d.body(); // FIXME 
    320                 // FIXME: don't need to memoize. The closure scope handles it for us. 
     319                // don't need to memoize. The closure scope handles it for us. 
    321320                var xpath = buildPath(path); 
    322321 
     
    349348                // function.  
    350349 
    351                 // FIXME: need to add support for alternate roots 
    352350                return getXPathFunc(query)(); 
    353351        } 
     
    937935        ); 
    938936        // uncomment to disable XPath for testing and tuning the DOM path 
    939         _getQueryFunc = getStepQueryFunc; 
     937        // _getQueryFunc = getStepQueryFunc; 
    940938 
    941939        // FIXME: we've got problems w/ the NodeList query()/filter() functions if we go XPath for everything 
     
    981979 
    982980        // FIXME:  
    983         //              Dean's new Base2 uses a system whereby queries themselves note if 
     981        //              Dean's Base2 uses a system whereby queries themselves note if 
    984982        //              they'll need duplicate filtering. We need to get on that plan!! 
    985983 
     
    10251023                //              dojo.query() supports a rich set of CSS3 selectors, including: 
    10261024                // 
    1027                 //                      * class selectors (e.g., ".foo") 
    1028                 //                      * node type selectors like "span" 
    1029                 //                      * " " descendant selectors 
    1030                 //                      * ">" child element selectors  
    1031                 //                      * "#foo" style ID selectors 
    1032                 //                      * "*" universal selector 
     1025                //                      * class selectors (e.g., `.foo`) 
     1026                //                      * node type selectors like `span` 
     1027                //                      * ` ` descendant selectors 
     1028                //                      * `>` child element selectors  
     1029                //                      * `#foo` style ID selectors 
     1030                //                      * `*` universal selector 
     1031                //                      * `~`, the immediately preceeded-by sibling selector 
     1032                //                      * `+`, the preceeded-by sibling selector 
    10331033                //                      * attribute queries: 
    1034                 //                              * "[foo]" attribute presence selector 
    1035                 //                              * "[foo='bar']" attribute value exact match 
    1036                 //                              * "[foo~='bar']" attribute value list item match 
    1037                 //                              * "[foo^='bar']" attribute start match 
    1038                 //                              * "[foo$='bar']" attribute end match 
    1039                 //                              * "[foo*='bar']" attribute substring match 
    1040                 //                      * ":first-child", ":last-child" positional selectors 
    1041                 //                      * ":nth-child(n)", ":nth-child(2n+1)" style positional calculations 
    1042                 //                      * ":nth-child(even)", ":nth-child(odd)" positional selectors 
    1043                 //                      * ":not(...)" negation pseudo selectors 
     1034                //                              * `[foo]` attribute presence selector 
     1035                //                              * `[foo='bar']` attribute value exact match 
     1036                //                              * `[foo~='bar']` attribute value list item match 
     1037                //                              * `[foo^='bar']` attribute start match 
     1038                //                              * `[foo$='bar']` attribute end match 
     1039                //                              * `[foo*='bar']` attribute substring match 
     1040                //                      * `:first-child`, `:last-child` positional selectors 
     1041                //                      * `:empty` content emtpy selector 
     1042                //                      * `:empty` content emtpy selector 
     1043                //                      * `:nth-child(n)`, `:nth-child(2n+1)` style positional calculations 
     1044                //                      * `:nth-child(even)`, `:nth-child(odd)` positional selectors 
     1045                //                      * `:not(...)` negation pseudo selectors 
    10441046                // 
    1045                 //              Any legal combination of those selector types as per the CSS 3 sepc 
    1046                 //              will work with dojo.query(), including compound selectors ("," 
    1047                 //              delimited). Very complex and useful searches can be constructed 
    1048                 //              with this palette of selectors and when combined with functions for 
     1047                //              Any legal combination of these selectors will work with 
     1048                //              `dojo.query()`, including compound selectors ("," delimited). 
     1049                //              Very complex and useful searches can be constructed with this 
     1050                //              palette of selectors and when combined with functions for 
    10491051                //              maniplation presented by dojo.NodeList, many types of DOM 
    10501052                //              manipulation operations become very straightforward. 
    10511053                //               
    10521054                //              Unsupported Selectors: 
    1053                 //              -------------------- 
     1055                //              ---------------------- 
    10541056                // 
    10551057                //              While dojo.query handles many CSS3 selectors, some fall outside of 
     
    10581060                //               
    10591061                //                      * namespace-differentiated selectors of any form 
    1060                 //                      * "~", the immediately preceeded-by sibling selector 
    1061                 //                      * "+", the preceeded-by sibling selector 
    1062                 //                      * all "::" pseduo-element selectors 
     1062                //                      * all `::` pseduo-element selectors 
    10631063                //                      * certain pseduo-selectors which don't get a lot of day-to-day use: 
    1064                 //                              * :root, :lang(), :target, :focus 
     1064                //                              * `:root`, `:lang()`, `:target`, `:focus` 
    10651065                //                      * all visual and state selectors: 
    1066                 //                              * :root, :active, :hover, :visisted, :link, :enabled, :disabled, :checked 
    1067                 //                      * :*-of-type pseudo selectors 
     1066                //                              * `:root`, `:active`, `:hover`, `:visisted`, `:link`, 
     1067                //                                `:enabled`, `:disabled`, `:checked` 
     1068                //                      * `:*-of-type` pseudo selectors 
    10681069                //               
    10691070                //              dojo.query and XML Documents: 
    10701071                //              ----------------------------- 
    1071                 //              FIXME 
    10721072                //               
    1073                 // NOTE: elementsById is not currently supported 
    1074                 // NOTE: ignores xpath-ish queries for now 
     1073                //              `dojo.query` currently only supports searching XML documents 
     1074                //              whose tags and attributes are 100% lower-case. This is a known 
     1075                //              limitation and will [be addressed soon](http://trac.dojotoolkit.org/ticket/3866) 
     1076                //              Non-selector Queries: 
     1077                //              --------------------- 
     1078                // 
     1079                //              If something other than a String is passed for the query, 
     1080                //              `dojo.query` will return a new `dojo.NodeList` constructed from 
     1081                //              that parameter alone and all further processing will stop. This 
     1082                //              means that if you have a reference to a node or NodeList, you 
     1083                //              can quickly construct a new NodeList from the original by 
     1084                //              calling `dojo.query(node)` or `dojo.query(list)`. 
    10751085                // 
    10761086                //      query: 
    10771087                //              The CSS3 expression to match against. For details on the syntax of 
    1078                 //              CSS3 selectors, see: 
    1079                 //                      http://www.w3.org/TR/css3-selectors/#selectors 
     1088                //              CSS3 selectors, see <http://www.w3.org/TR/css3-selectors/#selectors> 
    10801089                //      root: 
    1081                 //              A node (or string ID of a node) to scope the search from. Optional. 
    1082                 //      returns: 
    1083                 //              An instance of dojo.NodeList. Many methods are available on 
     1090                //              A DOMNode (or node id) to scope the search from. Optional. 
     1091                //      returns: dojo.NodeList 
     1092                //              An instance of `dojo.NodeList`. Many methods are available on 
    10841093                //              NodeLists for searching, iterating, manipulating, and handling 
    10851094                //              events on the matched nodes in the returned list. 
     1095                //      example: 
     1096                //              search the entire document for elements with the class "foo": 
     1097                //      |       dojo.query(".foo"); 
     1098                //              these elements will match: 
     1099                //      |       <span class="foo"></span> 
     1100                //      |       <span class="foo bar"></span> 
     1101                //      |       <p class="thud foo"></p> 
     1102                //      example: 
     1103                //              search the entire document for elements with the classes "foo" *and* "bar": 
     1104                //      |       dojo.query(".foo.bar"); 
     1105                //              these elements will match: 
     1106                //      |       <span class="foo bar"></span> 
     1107                //              while these will not: 
     1108                //      |       <span class="foo"></span> 
     1109                //      |       <p class="thud foo"></p> 
     1110                //      example: 
     1111                //              find `<span>` elements which are descendants of paragraphs and 
     1112                //              which have a "highlighted" class: 
     1113                //      |       dojo.query("p span.highlighted"); 
     1114                //              the innermost span in this fragment matches: 
     1115                //      |       <p class="foo"> 
     1116                //      |               <span>... 
     1117                //      |                       <span class="highlighted foo bar">...</span> 
     1118                //      |               </span> 
     1119                //      |       </p> 
     1120                //      example: 
     1121                //              set an "odd" class on all odd table rows inside of the table 
     1122                //              `#tabular_data`, using the `>` (direct child) selector to avoid 
     1123                //              affecting any nested tables: 
     1124                //      |       dojo.query("#tabular_data > tbody > tr:nth-child(odd)").addClass("odd"); 
     1125                //      example: 
     1126                //              remove all elements with the class "error" from the document 
     1127                //              and store them in a list: 
     1128                //      |       var errors = dojo.query(".error").orphan(); 
     1129                //      example: 
     1130                //              add an onclick handler to every submit button in the document 
     1131                //              which causes the form to be sent via Ajax instead: 
     1132                //      |       dojo.query("input[type='submit']").onclick(function(e){ 
     1133                //      |               dojo.stopEvent(e); // prevent sending the form 
     1134                //      |               var btn = e.target; 
     1135                //      |               dojo.xhrPost({ 
     1136                //      |                       form: btn.form, 
     1137                //      |                       load: function(data){ 
     1138                //      |                               // replace the form with the response 
     1139                //      |                               var div = dojo.doc.createElement("div"); 
     1140                //      |                               dojo.place(div, btn.form, "after"); 
     1141                //      |                               div.innerHTML = data; 
     1142                //      |                               dojo.style(btn.form, "display", "none"); 
     1143                //      |                       } 
     1144                //      |               }); 
     1145                //      |       }); 
     1146 
     1147 
     1148                // NOTE: elementsById is not currently supported 
     1149                // NOTE: ignores xpath-ish queries for now 
    10861150 
    10871151                if(query.constructor == d.NodeList){ 
     
    10951159                } 
    10961160 
    1097                 // FIXME: should support more methods on the return than the stock array. 
    1098                 return _zip(getQueryFunc(query)(root||d.doc)); 
     1161                return _zip(getQueryFunc(query)(root||d.doc)); // dojo.NodeList 
    10991162        } 
    11001163 
  • dojo/trunk/_base/window.js

    r12662 r12827  
    6262        //    correctly in managed contexts. 
    6363        // example: 
    64         //      n.appendChild(dojo.doc.createElement('div')); 
     64        //      |       n.appendChild(dojo.doc.createElement('div')); 
    6565} 
    6666=====*/ 
     
    7272        //              return the body object associated with dojo.doc 
    7373        // example: 
    74         //      dojo.body().appendChild(dojo.doc.createElement('div')); 
     74        //      |       dojo.body().appendChild(dojo.doc.createElement('div')); 
    7575 
    7676        // Note: document.body is not defined for a strict xhtml document 
     
    8383        //              changes the behavior of many core Dojo functions that deal with 
    8484        //              namespace and DOM lookup, changing them to work in a new global 
    85         //              context. The varibles dojo.global and dojo.doc 
    86         //              are modified as a result of calling this function. 
     85        //              context (e.g., an iframe). The varibles dojo.global and dojo.doc 
     86        //              are modified as a result of calling this function and the result of 
     87        //              `dojo.body()` likewise differs. 
    8788        dojo.global = globalObject; 
    8889        dojo.doc = globalDocument; 
  • dojo/trunk/_base/_loader/loader.js

    r12814 r12827  
    1414                _modulePrefixes: { 
    1515                        dojo:   {       name: "dojo", value: "." }, 
    16                         dojox:  {       name: "dojox", value: "../dojox" }, 
    17                         dijit:  {       name: "dijit", value: "../dijit" }, 
     16                        // dojox:       {       name: "dojox", value: "../dojox" }, 
     17                        // dijit:       {       name: "dijit", value: "../dijit" }, 
    1818                        doh:    {       name: "doh", value: "../util/doh" }, 
    1919                        tests:  {       name: "tests", value: "tests" } 
     
    7979        } 
    8080 
    81         dojo._loadUri = function(/*String (URL)*/uri, /*Function?*/cb){ 
     81        dojo._loadUri = function(/*String*/uri, /*Function?*/cb){ 
    8282                //      summary: 
    8383                //              Loads JavaScript from a URI 
     
    114114 
    115115        // FIXME: probably need to add logging to this method 
    116         dojo._loadUriAndCheck = function(/*String (URL)*/uri, /*String*/moduleName, /*Function?*/cb){ 
     116        dojo._loadUriAndCheck = function(/*String*/uri, /*String*/moduleName, /*Function?*/cb){ 
    117117                // summary: calls loadUri then findModule and returns true if both succeed 
    118118                var ok = false; 
     
    135135                this._loadNotifying = true; 
    136136                this._postLoad = true; 
    137                 var mll = this._loaders; 
     137                var mll = d._loaders; 
    138138                 
    139139                //Clear listeners so new ones can be added 
     
    154154                //after this first run. If something did, and we are not waiting for any 
    155155                //more inflight resources, run again. 
    156                 if(d._postLoad && d._inFlightCount == 0 && this._loaders.length){ 
     156                if(d._postLoad && d._inFlightCount == 0 && mll.length){ 
    157157                        d._callLoaded(); 
    158158                }