Apparently "replace" only replaces the first occurrence of the string, so
split/join is a more reliable route.

http://stackoverflow.com/questions/3214886/javascript-replace-only-replaces-
first-match

Tangent

p.s.  JavaScript is drunk.

-----Original Message-----
From: Justin Mclean [mailto:jus...@classsoftware.com] 
Sent: Saturday, October 19, 2013 6:40 PM
To: dev@flex.apache.org
Subject: Odd SDK code in Spark button

HI,

Looking to see if join("") was used anywhere else found this:

        if (!styleName || styleName is String)
        {
            if (_emphasized)
                super.styleName = style + " emphasized";
            else 
                super.styleName = style.split(" emphasized").join("");
        } 

Would not be a performance bottle neck but why not just use replace?

Justin

Reply via email to