Sha256: b759b38d67dd890f177584077edf42d2c4e8450071bb8b7fffa0ac5568506065

Contents?: true

Size: 874 Bytes

Versions: 1

Compression:

Stored size: 874 Bytes

Contents

# def add_new_class(class_name, tag_name, tag_content)
#
# `
#   var styleTag = document.getElementById("atomic_style");
#   styleTag.innerHTML += "\n."+#{class_name}+'{\n '+#{tag_name}+': '+#{tag_content}+';\n}\n\n\n\n';
# `
# end
#
# add_new_class('new_class', 'background-color','yellow')
# add_new_class('other_class', 'color','red')

# def update_css_tag(tag_name, var_name, value)
#   alert "this code doesn't work with chrome"
#   `
#   var rules = null;
#       var cssRules = document.styleSheets[0].cssRules;
#       for (var i = 0; i < cssRules.length; i++) {
#       var rule = cssRules[i];
#       if (rule.selectorText === '.'+#{tag_name}) {
#         rules = rule;
#         break;
#       }
#       }
#
#       if (rules) {
#
#       rules.style.setProperty(#{var_name}, #{value});
#       }
# `
# end

# update_css_tag('other_class', '--end-color', 'blue')

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
atome-0.5.4.1.9 lib/atome/renderers/browser/opal_add_on.rb