dojox/data/CssClassStore.js

  • Provides:

    • dojox.data.CssClassStore
  • dojox.data.CssClassStore

    • type
      Function
    • chains:
      • dojox.data.CssRuleStore: (prototype)
      • dojox.data.CssRuleStore: (call)
    • summary
      Basic store to display CSS information.
    • description
      The CssClassStore allows users to get information about active Css classes in the page running the CssClassStore.
      It can also filter out classes from specific stylesheets.  The attributes it exposes on classes are as follows:
      class:		The classname, including the '.'.
      classSans:	The classname without the '.'.
  • dojox.data.CssClassStore._labelAttribute

    • summary
  • dojox.data.CssClassStore._idAttribute

    • summary
  • dojox.data.CssClassStore._cName

    • summary
  • dojox.data.CssClassStore.getFeatures

    • type
      Function
    • source: [view]
        return {
         "dojo.data.api.Read" : true,
         "dojo.data.api.Identity" : true
        };
    • summary
      See dojo.data.api.Read.getFeatures()
  • dojox.data.CssClassStore.getAttributes

    • type
      Function
    • parameters:
      • item: (typeof )
    • source: [view]
        this._assertIsItem(item);
        return ['class', 'classSans'];
    • summary
      See dojo.data.api.Read.getAttributes()
  • dojox.data.CssClassStore.getValue

    • type
      Function
    • parameters:
      • item: (typeof )
      • attribute: (typeof )
      • defaultValue: (typeof )
    • source: [view]
        var values = this.getValues(item, attribute);
        if(values && values.length > 0){
         return values[0];
        }
        return defaultValue;
    • summary
      See dojo.data.api.Read.getValue()
  • dojox.data.CssClassStore.getValues

    • type
      Function
    • parameters:
      • item: (typeof )
      • attribute: (typeof )
    • source: [view]
        this._assertIsItem(item);
        this._assertIsAttribute(attribute);
        var value = [];
        if(attribute === "class"){
         value = [item.className];
        }else if(attribute === "classSans"){
         value = [item.className.replace(/\./g,'')];
        }
        return value;
    • summary
      See dojo.data.api.Read.getValues()
  • dojox.data.CssClassStore._handleRule

    • type
      Function
    • parameters:
      • rule: (typeof )
      • styleSheet: (typeof )
      • href: (typeof )
    • source: [view]
        var obj = {};
        var s = rule['selectorText'].split(" ");
        for(var j=0; j   var tmp = s[j];
         var first = tmp.indexOf('.');
         if(tmp && tmp.length > 0 && first !== -1){
          var last = tmp.indexOf(',') || tmp.indexOf('[');
          tmp = tmp.substring(first, ((last !== -1 && last > first)?last:tmp.length));
          obj[tmp] = true;
         }
        }
        for(var key in obj){
         if(!this._allItems[key]){
          var item = {};
          item.className = key;
          item[this._storeRef] = this;
          this._allItems[key] = item;
         }
        }
    • summary
      Handles the creation of an item based on the passed rule.  In this store, this implies
      parsing out all available class names.
  • dojox.data.CssClassStore._handleReturn

    • type
      Function
    • source: [view]
        var _inProgress = [];

        
        var items = {};
        for(var i in this._allItems){
         items[i] = this._allItems[i];
        }
        var requestInfo;
        // One-level deep clone (can't use dojo.clone, since we don't want to clone all those store refs!)
        while(this._pending.length){
         requestInfo = this._pending.pop();
         requestInfo.request._items = items;
         _inProgress.push(requestInfo);
        }


        while(_inProgress.length){
         requestInfo = _inProgress.pop();
         if(requestInfo.fetch){
          this._handleFetchReturn(requestInfo.request);
         }else{
          this._handleFetchByIdentityReturn(requestInfo.request);
         }
        }
    • summary
      Handles the return from a fetching action.  Delegates requests to act on the resulting
      item set to eitehr the _handleFetchReturn or _handleFetchByIdentityReturn depending on
      where the request originated.
  • dojox.data.CssClassStore._handleFetchByIdentityReturn

    • type
      Function
    • parameters:
      • request: (typeof )
    • source: [view]
        var items = request._items;
        // Per https://bugs.webkit.org/show_bug.cgi?id=17935 , Safari 3.x always returns the selectorText
        // of a rule in full lowercase.
        var item = items[(dojo.isWebKit?request.identity.toLowerCase():request.identity)];
        if(!this.isItem(item)){
         item = null;
        }
        if(request.onItem){
         var scope = request.scope || dojo.global;
         request.onItem.call(scope, item);
        }
    • summary
      Handles a fetchByIdentity request by finding the correct item.
    • chains:
      • request.onItem: (call)
  • dojox.data.CssClassStore.getIdentity

    • type
      Function
    • parameters:
      • item: (typeof item)
    • source: [view]
        this._assertIsItem(item);
        return this.getValue(item, this._idAttribute);
    • summary
      See dojo.data.api.Identity.getIdentity()
  • dojox.data.CssClassStore.getIdentityAttributes

    • type
      Function
    • parameters:
      • item: (typeof item)
    • source: [view]
        this._assertIsItem(item);
        return [this._idAttribute];
    • summary
      See dojo.data.api.Identity.getIdentityAttributes()
  • dojox.data.CssClassStore.fetchItemByIdentity

    • type
      Function
    • parameters:
      • request: (typeof request)
    • source: [view]
        request = request || {};
        if(!request.store){
         request.store = this;
        }
        if(this._pending && this._pending.length > 0){
         this._pending.push({request: request});
        }else{
         this._pending = [{request: request}];
         this._fetch(request);
        }
        return request;
    • summary
      See dojo.data.api.Identity.fetchItemByIdentity()
  • dojox.data.CssClassStore._pending

    • summary
  • dojox.data

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary