2012-02-15 27 views
2

我一直在關於flex的css文檔中遇到很多對style protochain的引用。我試圖查看它,但我找不到任何相關信息。任何人都可以告訴我StyleProtochain類是做什麼的? 在其源代碼中,有以下評論。什麼是款式首連?

/** 
* @private 
* This is an all-static class with methods for building the protochains 
* that Flex uses to look up CSS style properties. 
*/ 

酷,它告訴我,有一對夫婦爲建設protochains方法,現在我應該知道它做什麼,但我不知道什麼是protochain是。

回答

1

CSS樣式被繼承。這意味着,當您創建一個新對象並將其作爲另一個對象的子對象放置在DOM中時,此新對象將必須從父對象繼承所有「可繼承」樣式。然後,它將通過樣式名稱或內聯樣式來覆蓋這些樣式。

StyleProtoChain類負責構建創建的任何對象(可以有樣式)的此樣式列表。它的名字是這樣命名的,因爲這個類必須上去DOMtree(就像上了原型鏈......也許是用詞不當!)併爲這個對象構造樣式列表。這個註釋的順序是由這個註釋指定的。

/** 
    * @private 
    * If the styleName property points to a UIComponent, then we search 
    * for stylable properties in the following order: 
    * 
    * 1) Look for inline styles on this object 
    * 2) Look for inline styles on the styleName object 
    * 3) Look for class selectors on the styleName object 
    * 4) Look for type selectors on the styleName object 
    * 5) Look for type selectors on this object 
    * 6) Follow the usual search path for the styleName object 
    * 
    * If this object doesn't have any type selectors, then the 
    * search path can be simplified to two steps: 
    * 
    * 1) Look for inline styles on this object 
    * 2) Follow the usual search path for the styleName object 
    */ 

希望這會有所幫助。如果有人想進一步參考,你可以找到一個鏈接到源here

相關問題