Modify/remove CSS style

Adding a CSS style is pretty simple with fwAddCSSStyles.

But how to modify/remove a style?

Seems the are no commands in the FW Javascript Reference to access and manipulate CSS styles and properties directly.

So the only way would be to work directly on the text content of the style tag (via fwAddCSSStyles.fwToHTML()), delete the whole style tag and put the modified version back with fwAddRaw - which makes the action incompatible with other actions running after it.

Does anyone know a better approach?

Peter


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Further to the problem you have identified, there are also external stylesheets to bargain with. When I wrote my style_accessors action-library, I wanted to simplify the entire style morass such that you could set a style on an element directly:

var foo = fwDocument.fwTags.fwFind(fwItem);
foo.setStyle('color', 'red');

That looks really simple on the outside. But under the hood, it requires that I also provide a massive object full of “resets” for each possible style, so that you could also do this:

foo.setStyle('text-decoration', null);

and have it remove the style. In fact, it cannot remove the style, but what it does is reset it to a default value (different for each attribute).

More info about this library here:

Walter

On Nov 18, 2013, at 5:47 AM, Peter Gutbrod wrote:

Adding a CSS style is pretty simple with fwAddCSSStyles.

But how to modify/remove a style?

Seems the are no commands in the FW Javascript Reference to access and manipulate CSS styles and properties directly.

So the only way would be to work directly on the text content of the style tag (via fwAddCSSStyles.fwToHTML()), delete the whole style tag and put the modified version back with fwAddRaw - which makes the action incompatible with other actions running after it.

Does anyone know a better approach?

Peter


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

There’s a newer version with example Action here: freewayactions-tng/libs/library-actions at master · walterdavis/freewayactions-tng · GitHub

Joe


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options