You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pi...@apache.org on 2017/01/15 21:09:23 UTC

git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it from

Repository: flex-asjs
Updated Branches:
  refs/heads/develop 8018076b5 -> f29c2a480


FLEX-35243 - Fix problem with unselecting ToggleTextButton
- Use classList.toggle api in order to switch between selected and unselected state
- Make ToggleTextButton responsive in case of selecting it from code


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/f29c2a48
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/f29c2a48
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/f29c2a48

Branch: refs/heads/develop
Commit: f29c2a480c8b9080516cb180bb2c30650420d092
Parents: 8018076
Author: piotrz <pi...@apache.org>
Authored: Sun Jan 15 22:09:17 2017 +0100
Committer: piotrz <pi...@apache.org>
Committed: Sun Jan 15 22:09:17 2017 +0100

----------------------------------------------------------------------
 .../org/apache/flex/html/ToggleTextButton.as    | 55 +++++---------------
 1 file changed, 12 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f29c2a48/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/ToggleTextButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/ToggleTextButton.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/ToggleTextButton.as
index 53f4a7b..b9d1050 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/ToggleTextButton.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/ToggleTextButton.as
@@ -94,10 +94,7 @@ package org.apache.flex.html
 		}
 
         COMPILE::JS
-        private var _selected:Boolean;
-
-        COMPILE::JS
-        private var SELECTED:String = "selected";
+        private var _selected:Boolean = false;
 
         [Bindable("change")]
         /**
@@ -128,6 +125,8 @@ package org.apache.flex.html
             COMPILE::SWF
             {
                 IToggleButtonModel(model).selected = value;
+
+                dispatchEvent(new Event("change"));
             }
             COMPILE::JS
             {
@@ -135,52 +134,24 @@ package org.apache.flex.html
                 {
                     _selected = value;
 
-                    var className:String = this.className;
-                    var typeNames:String = this.typeNames;
-                    if (value) {
-                        if (typeNames.indexOf(SELECTED) == -1) {
-                            typeNames = typeNames + SELECTED;
-                            if (className)
-                                element.className = typeNames + ' ' + className;
-                            else
-                                element.className = typeNames;
-                        }
-                    }
-                    else {
-                        if (typeNames.indexOf(SELECTED) == typeNames.length - SELECTED.length) {
-                            typeNames = typeNames.substring(0, typeNames.length - SELECTED.length);
-                            if (className)
-                                element.className = typeNames + ' ' + className;
-                            else
-                                element.className = typeNames;
-                        }
-                    }
+                    element.classList.toggle("toggleTextButton_Selected", _selected == true);
+                    element.classList.toggle("toggleTextButton", _selected == false);
+                    typeNames = element.className;
+
+                    dispatchEvent(new Event("change"));
                 }
             }
         }
 
-        /**
-         *  @private
-         *  add another class selector
-         */
-        override public function get className():String
-        {
-            // we don't have a model yet so just pass through otherwise you will loop
-            if (!parent)
-                return super.className;
-
-            var name:String = super.className;
-            if (selected)
-                return "toggleTextButton_Selected" + (name ? " " + name : "");
-            else
-                return "toggleTextButton" + (name ? " " + name : "");
-        }
-
         COMPILE::JS
         override protected function createElement():WrappedHTMLElement
         {
             super.createElement();
             element.addEventListener("click", clickHandler, false);
+            element.classList.toggle("toggleTextButton_Selected", _selected == true);
+            element.classList.toggle("toggleTextButton", _selected == false);
+            typeNames = element.className;
+
             return element;
         }
 
@@ -188,14 +159,12 @@ package org.apache.flex.html
         private function clickHandler(event:Event):void
         {
             selected = !selected;
-            dispatchEvent(new Event("change"));
         }
 
         COMPILE::SWF
         private function internalMouseHandler(event:MouseEvent) : void
         {
             selected = !selected;
-            dispatchEvent(new Event("change"));
         }
 	}
 }


Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by Alex Harui <ah...@adobe.com>.

On 1/16/17, 11:02 PM, "piotrz" <pi...@gmail.com> wrote:

>In my Maven dependencies I don't have Basic, do you think that could
>problem
>with some pom in framework itself ?

Maybe.  Don't know enough about Maven to know.

-Alex


Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by piotrz <pi...@gmail.com>.
In my Maven dependencies I don't have Basic, do you think that could problem
with some pom in framework itself ?

Piotr



-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/Re-git-commit-flex-asjs-refs-heads-develop-FLEX-35243-Fix-problem-with-unselecting-ToggleTextButton-m-tp58321p58391.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by Alex Harui <ah...@adobe.com>.
Hmm.  HTML should be built after Basic and thus win.  If you are using
Maven, why is Basic even in the dependencies?

-Alex

On 1/16/17, 9:42 PM, "piotrz" <pi...@gmail.com> wrote:

>I just tried ToggleTextButton in IE11 and it's display component from
>package
>Basic instead HTML - should I change also Basic ?
>
>What's could be wrong ?
>
>Piotr
>
>
>
>-----
>Apache Flex PMC
>piotrzarzycki21@gmail.com
>--
>View this message in context:
>http://apache-flex-development.2333347.n4.nabble.com/Re-git-commit-flex-as
>js-refs-heads-develop-FLEX-35243-Fix-problem-with-unselecting-ToggleTextBu
>tton-m-tp58321p58386.html
>Sent from the Apache Flex Development mailing list archive at Nabble.com.


Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it from

Posted by piotrz <pi...@gmail.com>.
I just tried ToggleTextButton in IE11 and it's display component from package
Basic instead HTML - should I change also Basic ? 

What's could be wrong ?

Piotr



-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/Re-git-commit-flex-asjs-refs-heads-develop-FLEX-35243-Fix-problem-with-unselecting-ToggleTextButton-m-tp58321p58386.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by Alex Harui <ah...@adobe.com>.
I thought [2] indicated other problems on IE10.  It might be a good idea
to actually try it.  Until we implement a polyfill, doesn't this break IE9
support or have we taken another change already that breaks IE9?

[2] https://developer.mozilla.org/en-US/docs/Web/API/Element/classList

On 1/16/17, 9:38 AM, "piotrz" <pi...@gmail.com> wrote:

>Let's say that I will stay with this code. We will see whether someone
>will
>complain. I will modify it in order to support also IE11 [1] cause it has
>some issues.
>
>http://caniuse.com/#search=classList
>
>Piotr
>
>
>
>-----
>Apache Flex PMC
>piotrzarzycki21@gmail.com
>--
>View this message in context:
>http://apache-flex-development.2333347.n4.nabble.com/Re-git-commit-flex-as
>js-refs-heads-develop-FLEX-35243-Fix-problem-with-unselecting-ToggleTextBu
>tton-m-tp58321p58372.html
>Sent from the Apache Flex Development mailing list archive at Nabble.com.


Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by piotrz <pi...@gmail.com>.
Let's say that I will stay with this code. We will see whether someone will
complain. I will modify it in order to support also IE11 [1] cause it has
some issues.

http://caniuse.com/#search=classList

Piotr



-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/Re-git-commit-flex-asjs-refs-heads-develop-FLEX-35243-Fix-problem-with-unselecting-ToggleTextButton-m-tp58321p58372.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by piotrz <pi...@gmail.com>.
It is event better, cause MSDN saying that classList is supported from IE10
[1][2]

[1] https://msdn.microsoft.com/en-us/library/hh968262(v=vs.85).aspx
[2] https://msdn.microsoft.com/en-us/library/hh771925(v=vs.85).aspx

Piotr



-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/Re-git-commit-flex-asjs-refs-heads-develop-FLEX-35243-Fix-problem-with-unselecting-ToggleTextButton-m-tp58321p58374.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by Josh Tynjala <jo...@gmail.com>.
Yes.

https://developer.mozilla.org/en-US/docs/Glossary/Polyfill

- Josh

On Mon, Jan 16, 2017 at 9:18 AM, piotrz <pi...@gmail.com> wrote:

> Alex,
>
> I'm not sure what do you mean by saying polyfills for IE? It's some library
> which handle do not existing API in older browser ?
>
> Piotr
>
>
>
> -----
> Apache Flex PMC
> piotrzarzycki21@gmail.com
> --
> View this message in context: http://apache-flex-
> development.2333347.n4.nabble.com/Re-git-commit-flex-asjs-
> refs-heads-develop-FLEX-35243-Fix-problem-with-unselecting-
> ToggleTextButton-m-tp58321p58369.html
> Sent from the Apache Flex Development mailing list archive at Nabble.com.
>

Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by piotrz <pi...@gmail.com>.
Alex,

I'm not sure what do you mean by saying polyfills for IE? It's some library
which handle do not existing API in older browser ?

Piotr



-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/Re-git-commit-flex-asjs-refs-heads-develop-FLEX-35243-Fix-problem-with-unselecting-ToggleTextButton-m-tp58321p58369.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by Alex Harui <ah...@adobe.com>.

On 1/16/17, 9:02 AM, "piotrz" <pi...@gmail.com> wrote:

>I think I will go back to older way of adding those properties className
>+=.
>Maybe IE9 is not so important, but IE10 is still around.

I've been wondering if there is a PAYG way of injecting polyfills just for
IE.  It might be better to spend energy on that instead of reverting.

Any thoughts on how to do that?  Maybe our default HTML fetches a script
for IE?

-Alex


Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by piotrz <pi...@gmail.com>.
Make sense. Our MDL library for example is using a log classList API, so
minimum browser is Edge, cause IE11 for example do not handle second
parameter for classList.toggle(). 

If I change a bit code for this issue I will be able to handle IE11, but
still will use this really nice and handy api from classList. :)

Piotr



-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/Re-git-commit-flex-asjs-refs-heads-develop-FLEX-35243-Fix-problem-with-unselecting-ToggleTextButton-m-tp58321p58371.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by Josh Tynjala <jo...@gmail.com>.
Last I checked, IE10 marketshare was actually significantly lower than IE9.
I recall that a lot of people were stuck on IE9 without an upgrade option,
but IE10 users could upgrade to IE11, and they did. If IE9 is not
considered important anymore, IE10 can probably be safely skipped!

- Josh

On Mon, Jan 16, 2017 at 9:02 AM, piotrz <pi...@gmail.com> wrote:

> I think I will go back to older way of adding those properties className
> +=.
> Maybe IE9 is not so important, but IE10 is still around.
>
> Piotr
>
>
>
> -----
> Apache Flex PMC
> piotrzarzycki21@gmail.com
> --
> View this message in context: http://apache-flex-
> development.2333347.n4.nabble.com/Re-git-commit-flex-asjs-
> refs-heads-develop-FLEX-35243-Fix-problem-with-unselecting-
> ToggleTextButton-m-tp58321p58366.html
> Sent from the Apache Flex Development mailing list archive at Nabble.com.
>

Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by piotrz <pi...@gmail.com>.
I think I will go back to older way of adding those properties className +=.
Maybe IE9 is not so important, but IE10 is still around.

Piotr



-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/Re-git-commit-flex-asjs-refs-heads-develop-FLEX-35243-Fix-problem-with-unselecting-ToggleTextButton-m-tp58321p58366.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by Alex Harui <ah...@adobe.com>.

On 1/16/17, 7:59 AM, "piotrz" <pi...@gmail.com> wrote:

>Do we have specified any places where we are stating about supporting
>older
>browser than IE11 ? If not I would live it as is.

I believe some wiki page says IE9.  It used to say IE8.  We just need to
understand whether our customer base has truly moved on or not before we
switch to IE10 or 11.

-Alex


Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by piotrz <pi...@gmail.com>.
Do we have specified any places where we are stating about supporting older
browser than IE11 ? If not I would live it as is.

Piotr



-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/Re-git-commit-flex-asjs-refs-heads-develop-FLEX-35243-Fix-problem-with-unselecting-ToggleTextButton-m-tp58321p58361.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

> So if 1% is roughly 1000 users, does that mean 100,000 different people
> visited flex.a.o in the last six months?

Distinct users are around the 60,000 mark for the last 6 months.

Thanks,
Justin

Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by Alex Harui <ah...@adobe.com>.

On 1/16/17, 12:34 PM, "Justin Mclean" <ju...@classsoftware.com> wrote:

>Hi,
>
>We can also can get some idea from visits on our web site in google
>analytics. Note the audience is developers not users of flex, but it
>still may be useful.	
>
>For the last 6 months browser share is roughly:
>Chrome 66%
>Firefox 16%
>AdobeAIR 10%
>Safari 6%
>IE 5% (85% IE11, 6% IE8, 4% IE9, 3% IE10)
>
>So IE11 is the majority of IE visit but IE8 is next. IE8 + IE9 make 10%
>of IE users to our site which surprised me.
>
>Even with the low % we still talking 1000’s of users. Above 1% = roughly
>1000 users.

Interesting numbers.  Thanks for posting it.

So if 1% is roughly 1000 users, does that mean 100,000 different people
visited flex.a.o in the last six months?

IMO, my takeaway is that old IE usage is non-zero.  The % doesn't matter
too much to me.  What we really want to know is what our next customer is
using.  My understanding is that in some big corps, there are dozens of
workers behind firewalls cranking on Flex apps using some old IE version.
That information, however, is about 5 years old.  But any public
information may not contain those behind-the-firewall users so what we
really need is for folks with Flex apps who are interested in FlexJS to
tell us if they are using IE and what version.

-Alex


Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

We can also can get some idea from visits on our web site in google analytics. Note the audience is developers not users of flex, but it still may be useful.	

For the last 6 months browser share is roughly:
Chrome 66%
Firefox 16%
AdobeAIR 10%
Safari 6%
IE 5% (85% IE11, 6% IE8, 4% IE9, 3% IE10)

So IE11 is the majority of IE visit but IE8 is next. IE8 + IE9 make 10% of IE users to our site which surprised me.

Even with the low % we still talking 1000’s of users. Above 1% = roughly 1000 users.

Thanks,
Justin


Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by Christofer Dutz <ch...@c-ware.de>.
Hi Alex,

Doesn’t Adobe have exactly such a service? I remember when being a Creative Suite Customer in the past there was a service that provided statistics on Browser and Feature usage. Shouldn’t you be able to get your hands on such data?

Chris

Am 16.01.17, 17:50 schrieb "Alex Harui" <ah...@adobe.com>:

    
    
    On 1/16/17, 7:40 AM, "carlos.rovira@gmail.com on behalf of Carlos Rovira"
    <carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com> wrote:
    
    >We should remember that MS has left support this days for IE9 and IE10.
    >I think we should be running away from those browsers...
    
    I agree that as every day goes by, the relevance of those older versions
    becomes more questionable.  Many large enterprises used to standardize on
    IE and on a version that is one or two generations old.  Don't know if
    that's still true or not.  If we want to attract these big enterprises, we
    need to find out what they are running and use that to guide our baseline
    versions.
    
    -Alex
    
    


Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by Alex Harui <ah...@adobe.com>.

On 1/16/17, 7:40 AM, "carlos.rovira@gmail.com on behalf of Carlos Rovira"
<carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com> wrote:

>We should remember that MS has left support this days for IE9 and IE10.
>I think we should be running away from those browsers...

I agree that as every day goes by, the relevance of those older versions
becomes more questionable.  Many large enterprises used to standardize on
IE and on a version that is one or two generations old.  Don't know if
that's still true or not.  If we want to attract these big enterprises, we
need to find out what they are running and use that to guide our baseline
versions.

-Alex


Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by Carlos Rovira <ca...@codeoscopic.com>.
We should remember that MS has left support this days for IE9 and IE10.
I think we should be running away from those browsers...

2017-01-16 16:15 GMT+01:00 Alex Harui <ah...@adobe.com>:

> On 1/15/17, 11:30 PM, "piotrz" <pi...@gmail.com> wrote:
>
> >Guys,
> >
> >Should this code for selection in JS be somewhere else ?
>
> Well, doesn't classList have questionable support on IE9 and 10?
> Otherwise I guess it is fine where it is.  What are your concerns?
>
> -Alex
>
>
>
>
> >
> >Piotr
> >
> >
> >
> >-----
> >Apache Flex PMC
> >piotrzarzycki21@gmail.com
> >--
> >View this message in context:
> >http://apache-flex-development.2333347.n4.nabble.
> com/Re-git-commit-flex-as
> >js-refs-heads-develop-FLEX-35243-Fix-problem-with-
> unselecting-ToggleTextBu
> >tton-m-tp58321p58331.html
> >Sent from the Apache Flex Development mailing list archive at Nabble.com.
>
>


-- 

Carlos Rovira
Director General
M: +34 607 22 60 05
http://www.codeoscopic.com
http://www.avant2.es

Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si ha recibido este mensaje por
error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
proceda a su destrucción.

De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
S.A. La finalidad de dicho tratamiento es facilitar la prestación del
servicio o información solicitados, teniendo usted derecho de acceso,
rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
necesaria.

Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it...

Posted by Alex Harui <ah...@adobe.com>.
On 1/15/17, 11:30 PM, "piotrz" <pi...@gmail.com> wrote:

>Guys,
>
>Should this code for selection in JS be somewhere else ?

Well, doesn't classList have questionable support on IE9 and 10?
Otherwise I guess it is fine where it is.  What are your concerns?

-Alex




>
>Piotr
>
>
>
>-----
>Apache Flex PMC
>piotrzarzycki21@gmail.com
>--
>View this message in context:
>http://apache-flex-development.2333347.n4.nabble.com/Re-git-commit-flex-as
>js-refs-heads-develop-FLEX-35243-Fix-problem-with-unselecting-ToggleTextBu
>tton-m-tp58321p58331.html
>Sent from the Apache Flex Development mailing list archive at Nabble.com.


Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it from

Posted by piotrz <pi...@gmail.com>.
Guys,

Should this code for selection in JS be somewhere else ?

Piotr



-----
Apache Flex PMC
piotrzarzycki21@gmail.com
--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/Re-git-commit-flex-asjs-refs-heads-develop-FLEX-35243-Fix-problem-with-unselecting-ToggleTextButton-m-tp58321p58331.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: git commit: [flex-asjs] [refs/heads/develop] - FLEX-35243 - Fix problem with unselecting ToggleTextButton - Use classList.toggle api in order to switch between selected and unselected state - Make ToggleTextButton responsive in case of selecting it from

Posted by Piotr Zarzycki <pi...@gmail.com>.
I just fixed my first issue in basic component. Let me know if it's ok. I
used classList api to do this. :)
I did also bindable "selected" property.

Piotr

2017-01-15 22:09 GMT+01:00 <pi...@apache.org>:

> Repository: flex-asjs
> Updated Branches:
>   refs/heads/develop 8018076b5 -> f29c2a480
>
>
> FLEX-35243 - Fix problem with unselecting ToggleTextButton
> - Use classList.toggle api in order to switch between selected and
> unselected state
> - Make ToggleTextButton responsive in case of selecting it from code
>
>
> Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
> Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/f29c2a48
> Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/f29c2a48
> Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/f29c2a48
>
> Branch: refs/heads/develop
> Commit: f29c2a480c8b9080516cb180bb2c30650420d092
> Parents: 8018076
> Author: piotrz <pi...@apache.org>
> Authored: Sun Jan 15 22:09:17 2017 +0100
> Committer: piotrz <pi...@apache.org>
> Committed: Sun Jan 15 22:09:17 2017 +0100
>
> ----------------------------------------------------------------------
>  .../org/apache/flex/html/ToggleTextButton.as    | 55 +++++---------------
>  1 file changed, 12 insertions(+), 43 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> f29c2a48/frameworks/projects/HTML/src/main/flex/org/apache/
> flex/html/ToggleTextButton.as
> ----------------------------------------------------------------------
> diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/ToggleTextButton.as
> b/frameworks/projects/HTML/src/main/flex/org/apache/flex/
> html/ToggleTextButton.as
> index 53f4a7b..b9d1050 100644
> --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/
> html/ToggleTextButton.as
> +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/
> html/ToggleTextButton.as
> @@ -94,10 +94,7 @@ package org.apache.flex.html
>                 }
>
>          COMPILE::JS
> -        private var _selected:Boolean;
> -
> -        COMPILE::JS
> -        private var SELECTED:String = "selected";
> +        private var _selected:Boolean = false;
>
>          [Bindable("change")]
>          /**
> @@ -128,6 +125,8 @@ package org.apache.flex.html
>              COMPILE::SWF
>              {
>                  IToggleButtonModel(model).selected = value;
> +
> +                dispatchEvent(new Event("change"));
>              }
>              COMPILE::JS
>              {
> @@ -135,52 +134,24 @@ package org.apache.flex.html
>                  {
>                      _selected = value;
>
> -                    var className:String = this.className;
> -                    var typeNames:String = this.typeNames;
> -                    if (value) {
> -                        if (typeNames.indexOf(SELECTED) == -1) {
> -                            typeNames = typeNames + SELECTED;
> -                            if (className)
> -                                element.className = typeNames + ' ' +
> className;
> -                            else
> -                                element.className = typeNames;
> -                        }
> -                    }
> -                    else {
> -                        if (typeNames.indexOf(SELECTED) ==
> typeNames.length - SELECTED.length) {
> -                            typeNames = typeNames.substring(0,
> typeNames.length - SELECTED.length);
> -                            if (className)
> -                                element.className = typeNames + ' ' +
> className;
> -                            else
> -                                element.className = typeNames;
> -                        }
> -                    }
> +                    element.classList.toggle("toggleTextButton_Selected",
> _selected == true);
> +                    element.classList.toggle("toggleTextButton",
> _selected == false);
> +                    typeNames = element.className;
> +
> +                    dispatchEvent(new Event("change"));
>                  }
>              }
>          }
>
> -        /**
> -         *  @private
> -         *  add another class selector
> -         */
> -        override public function get className():String
> -        {
> -            // we don't have a model yet so just pass through otherwise
> you will loop
> -            if (!parent)
> -                return super.className;
> -
> -            var name:String = super.className;
> -            if (selected)
> -                return "toggleTextButton_Selected" + (name ? " " + name :
> "");
> -            else
> -                return "toggleTextButton" + (name ? " " + name : "");
> -        }
> -
>          COMPILE::JS
>          override protected function createElement():WrappedHTMLElement
>          {
>              super.createElement();
>              element.addEventListener("click", clickHandler, false);
> +            element.classList.toggle("toggleTextButton_Selected",
> _selected == true);
> +            element.classList.toggle("toggleTextButton", _selected ==
> false);
> +            typeNames = element.className;
> +
>              return element;
>          }
>
> @@ -188,14 +159,12 @@ package org.apache.flex.html
>          private function clickHandler(event:Event):void
>          {
>              selected = !selected;
> -            dispatchEvent(new Event("change"));
>          }
>
>          COMPILE::SWF
>          private function internalMouseHandler(event:MouseEvent) : void
>          {
>              selected = !selected;
> -            dispatchEvent(new Event("change"));
>          }
>         }
>  }
>
>


-- 

Greetings
Piotr Zarzycki

Flex/AIR/.NET Developer

mobile: +48 880 859 557
e-mail: piotrzarzycki21@gmail.com
skype: zarzycki10

LinkedIn: http://www.linkedin.com/piotrzarzycki
<https://pl.linkedin.com/in/piotr-zarzycki-92a53552>