Reply 225273 to: Question on DOM node

Avatar: Nico313
Nico313
Participant
November 19, 2019 at 15:15

We have patched the style function (line 1970) of etheme.js file to solve our problem. We noticed that style value is directly set in the “styleName” variable (background: #00000000) and not in “value” variable. Also we have added a check condition to detect these cases for remove value in “styleName” and put it in “value”.

// The style function
$.fn.style = function(styleName, value, priority) {
  // DOM node
  var node = this.get(0);
  // Ensure we have a DOM node
  if (typeof node == 'undefined') {
    return;
  }
  // CSSStyleDeclaration
  var style = this.get(0).style;
  // Getter/Setter
  if (typeof styleName != 'undefined') {
    // Check if value is already in style
    if (styleName.indexOf(':') > 0) {
        var i = styleName.indexOf(':');
        value = (typeof value != 'undefined') ? value : styleName.substring(i+1, styleName.length);
        styleName = styleName.substring(0, i);
    }
    if (typeof value != 'undefined') {
      // Set style property
      priority = typeof priority != 'undefined' ? priority : '';
      style.setProperty(styleName, value, priority);
    } else {
      // Get style property
      return style.getPropertyValue(styleName);
    }
  } else {
    // Get CSSStyleDeclaration
    return style;
  }
};

Can you integrate it in the next template update?

Thank you,

Regards

Go To The Whole Conversation In Topic
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.