template::set_css_property (public)
template::set_css_property [ -class class ] \ [ -querySelector querySelector ] -property property -value value
Defined in packages/acs-templating/tcl/head-procs.tcl
Set the specified CSS property in the DOM tree of the browser for elements for the specified class or query selector. This function should be used sparely in special situations, where CSS modification other approaches might be too complex.
- Switches:
- -class (optional)
- CSS class for which properties is set
- -querySelector (optional)
- CSS querySelector via the javascript function querySelectorAll
- -property (required)
- CSS property
- -value (required)
- value for the CSS property
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: if {[info exists class]} { set selector [subst {document.getElementsByClassName("$class")}] } elseif {[info exists querySelector]} { set selector [subst {document.querySelectorAll("$querySelector")}] } else { error "either 'class' or 'querySelector' must be specified" } template::add_script -section body -script [subst -nocommands { window.addEventListener('DOMContentLoaded', (event) => { var els = $selector; for(var i = 0; i < els.length; i++) { els[i].style.$property = "$value"; } }); }]XQL Not present: Generic, PostgreSQL, Oracle