Question on DOM node - by Nico313 - on WordPress WooCommerce support

This topic has 4 replies, 2 voices, and was last updated 4 years, 12 months ago ago by Olga Barlow

  • Avatar: Nico313
    Nico313
    Participant
    November 18, 2019 at 14:36

    Hello, i’ve an issue with this function :

      // 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') {
          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;
        }
      };

    Precisely

        // DOM node
        var node = this.get(0);
        // Ensure we have a DOM node
        if (typeof node == 'undefined') {
          return;
        }

    It broke :
    Contact Us all-in-one button
    https://codecanyon.net/item/contact-us-allinone-button-with-callback-request-feature-for-wordpress/22266189

    Could you tell me what is :

        // DOM node
        var node = this.get(0);
        // Ensure we have a DOM node
        if (typeof node == 'undefined') {
          return;
        }

    Thank you

    3 Answers
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    November 19, 2019 at 10:31

    Hello,

    That code is for the media player. Could you, please, describe your actions step by step when you get the error and provide Dashboard and FTP access to check and help you?

    Regards

    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

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    November 19, 2019 at 18:54

    Hello,

    I have passed your solution to our developers and they told me that fix included in the next update.

    Regards

  • Viewing 4 results - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.