[webkit-gtk] I want to change style of HTML on run time natively (Inside web core, I am having Element pointer).

Niranjan Rao nhrdls at gmail.com
Mon Apr 29 14:01:56 PDT 2013


Perhaps Webkit dom functions can be useful.

  get_computed_style on WebKitDOMDOMWindow which returns 
WebKitDOMCSSStyleDeclaration. This class allows you to set the property 
back. Don't know if it will reflect back, but won't hurt trying.

Look for functions in the header files.

Regards,

Niranjan


On 04/29/2013 01:14 PM, Brendan Long wrote:
> The way I would do it is by defining CSS classes for what I want, and 
> then just append the CSS class:
>
> // In your css
> .green { background-color: green; }
>
> // In your JavaScript
> element.className += " green"; // Don't forget the leading space
>
> Obviously "green" isn't a very good class name, and you should give it 
> a name that explains why it's green..
>
> See this StackOverflow question:
>
> http://stackoverflow.com/questions/195951/change-an-elements-css-class-with-javascript
>
> On 04/26/2013 06:52 AM, 85.mukesh wrote:
>>
>> Hi ,
>>
>> I want to change style of HTML on run time natively (Inside web core, 
>> I am having Element pointer). But using Element.setAttribute("style", 
>> "background-color: green;"); is overriding my style but I want to 
>> update the style without changing existing one. Please let me know if 
>> any trick is there to update style.
>>
>> I tried below things.
>>
>> 1. First get attribute and do string manipulation to add your style 
>> and the setattribute. This method is ok. But so much string manipulation.
>>
>> 2. I am not sure how we can directly handle code inside webcore 
>> natively for below JS code. Element.style.backgroundColor = "green";
>>
>> Regards,
>>
>> MK
>>
>>
>>
>> _______________________________________________
>> webkit-gtk mailing list
>> webkit-gtk at lists.webkit.org
>> https://lists.webkit.org/mailman/listinfo/webkit-gtk
>
>
>
> _______________________________________________
> webkit-gtk mailing list
> webkit-gtk at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-gtk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-gtk/attachments/20130429/ed5bc672/attachment.html>


More information about the webkit-gtk mailing list