Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    re-implementing String.trim brokes enabled/visibility rules in SmartClient 11

    Hello, I just want to let you know a problem I had, due to a mistake I made, in case it requires some safety check in the framework or simply if someone else got the same problem.
    I had a definition of String.trim like that:

    Code:
        String.prototype.trim = function () {
            return this.replace(/^\s+|\s+$/g, "");
        };
    I've used it since SmartClient 7, without problems.

    Now I was testing the enabled and visibility rules in my application and they won't work, with warnings like:

    Code:
    WARN:RulesEngine:isc_RulesEngine_0:RulesEngine unable to resolve locator specified on rule.
    My bad, I didn't have a check to be sure to implement String.trim only if not already available. Now I've modified it in:
    Code:
    if (!String.prototype.trim) {
        String.prototype.trim = function () {
            return this.replace(/^\s+|\s+$/g, "");
        };
    }
    And everything works.

    I don't know if it may require some safety check in the framework, anyway you may test it by adding the former implementation in the #enabledAndVisibilityRules showcase sample.
Working...
X