Hi Nevo:
        Thanks your response.Through that link i understand how to create a
new StyleSheet in javascript.

        Besides understanding this, but i also want to know webkit why not
support script "var a = new StyleSheet;",how can i change some c/c++ codes
in webkit to let it support this script.

Best Regards.
Suk

2009/6/5 Nevo <[email protected]>

> hi:
> I havn't used the StyleSheet object like in this way ,so here's my guess :
> The stylesheet is usually defined in server side ,people usually retrieve
> stylesheet via DOM StyleSheetObject (document.styleSheets). If you wanna
> create a new StyleSheet in your javascript. you probably may look at this
> http://eightpence.com/creating-new-css-stylesheets-with-javascript/
>
> Nevo
>
>
> 2009/6/5 Suk Zhong <[email protected]>
>
>> Hi All:
>>    We're trying to extend WebKit dom js binding.We have some questions.
>>
>>    in DOMWindow.idl having the following code:
>>    attribute StyleSheetConstructor StyleSheet;
>>    attribute [JSCCustomGetter] XMLHttpRequestConstructor XMLHttpRequest;
>>
>>    and we find class JSXMLHttpRequestConstructor has function
>> getConstructData, while JSStyleSheetConstructor doesn't have function
>> getConstructData.
>>
>>    if test the following js script:"var a = new XMLHttpRequest;", it's
>> ok;but "var a = new StyleSheet;", it'll throw an exception.
>>
>>    and we trac this problem to Interpreter::privateExecute() and
>> JSValuePtr::getConstructData function
>>
>>    inline ConstructType JSValuePtr::getConstructData(ConstructData&
>> constructData)
>>    {
>>         return JSImmediate::isImmediate(asValue()) ? ConstructTypeNone :
>> asCell()->getConstructData(constructData);
>>    }
>>    and we know this function returns ConstructTypeNone for
>> JSStyleSheetConstructor object,  ConstructTypeHost for
>> JSXMLHttpRequestConstructor object;
>>
>>    JSStyleSheetConstructor object and JSXMLHttpRequestConstructor object
>> are returned by the same template function getDOMConstructor.
>>
>>    our questions are:
>>
>>    1.why it has this return?
>>    2.which codes make the two object have different immediate value?
>>    3.some people can explain the whole role of class JSImmediate?
>>    4.our trac maybe be not correct,who can explain why newing StyleSheet
>> has exception and newing XMLHttpRequest is OK?
>>
>> Thanks and Best Regards
>>
>> Suk
>>
>> _______________________________________________
>> webkit-dev mailing list
>> [email protected]
>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>>
>>
>
_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to