flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject Re: [FlexJS] MDL Dialog working cross browser
Date Fri, 20 Jan 2017 23:21:01 GMT
OK, I think I get it.

The code "if (!dialog.showModal)" is a test for a dynamic property being
added, but when dialog is declared as HTMLDialogElement, it assumes the
object has a showModal method.

IMO, it is a bug that dialog.showModal in an if condition outputs a call
to Language.closure, but really, this sort of test isn't safe across
platforms.  You might want to try using "in":

    if (!("showModal" in dialog))

-Alex

On 1/20/17, 2:58 PM, "carlos.rovira@gmail.com on behalf of Carlos Rovira"
<carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com> wrote:

>I send too quickly. I want to ask you if the sentence
>
>*f (!dialog.showModal) {*
>
>not working could be considered a bug, or maybe here the brackets notation
>is correct
>
>btw, I think that without count this issue, all is right now :)
>
>
>
>
>2017-01-20 23:55 GMT+01:00 Carlos Rovira <carlos.rovira@codeoscopic.com>:
>
>> Hi Alex
>>
>> in the code below you can see that at the end dialog.showModal() works
>>now
>> (as well dialog.close())
>> but
>>
>> *if (!dialog.showModal) {*
>>
>> not works. to make it works I change to : if (!dialog["showModal"]) {
>>
>>
>>
>> org.apache.flex.mdl.Dialog.prototype.showModal = function() {
>>   if (!this.lockDialogCreation) {
>>     this.lockDialogCreation = true;
>>     if (org.apache.flex.mdl.Application.topLevelApplication != null) {
>>       org.apache.flex.mdl.Application.topLevelApplication.
>> addElement(this);
>>     }
>>     if (!org.apache.flex.utils.Language.closure(this.dialog.showModal,
>> this.dialog, 'showModal')) {.  *<-- line 88 is not working.*
>>       dialogPolyfill.registerDialog(this.dialog);
>>     }
>>   }
>>   this.dialog.showModal();  *<-- This is working right *
>> };
>>
>> 2017-01-20 22:31 GMT+01:00 Alex Harui <aharui@adobe.com>:
>>
>>> The link appears to show a stack trace.  What is the Dialog.js code
>>>around
>>> those line numbers?
>>>
>>> -Alex
>>>
>>> On 1/20/17, 12:09 PM, "carlos.rovira@gmail.com on behalf of Carlos
>>> Rovira"
>>> <carlos.rovira@gmail.com on behalf of carlos.rovira@codeoscopic.com>
>>> wrote:
>>>
>>> >Hi Alex,
>>> >
>>> >I modified as you said:
>>> >
>>> >/**
>>> >         * @flexjsignorecoercion
>>>org.apache.flex.core.WrappedHTMLElement
>>> >* @flexjsignorecoercion HTMLDialogElement
>>> >         */
>>> >        COMPILE::JS
>>> >        override protected function createElement():WrappedHTMLElement
>>> >        {
>>> >            typeNames = "mdl-dialog";
>>> >
>>> >            dialog = document.createElement('dialog') as
>>> >HTMLDialogElement;
>>> >element = dialog as WrappedHTMLElement;
>>> >
>>> >
>>> >Now the error is diferent:
>>> >
>>> >goog.bindNative_ = function(fn, selfObj, var_args) {
>>> >  return /** @type {!Function} */ (fn.call.apply(fn.bind, arguments));
>>> > <-- TypeError: undefined is not an object (evaluating 'fn.call')
>>> >};
>>> >
>>> >
>>> >See the image :
>>> >
>>> >http://imgur.com/fM9CeL5
>>> >
>>> >
>>> >
>>> >2017-01-20 18:55 GMT+01:00 Alex Harui <aharui@adobe.com>:
>>> >
>>> >>
>>> >>
>>> >> On 1/20/17, 9:47 AM, "carlos.rovira@gmail.com on behalf of Carlos
>>> >>Rovira"
>>> >> <carlos.rovira@gmail.com on behalf of carlosrovira@apache.org>
>>>wrote:
>>> >>
>>> >> >sorry in
>>> >> >
>>> >> >http://caniuse.com/#feat=dialog
>>> >> >
>>> >> ><http://caniuse.com/#feat=dialog>Safari 10 is in red and so
"not
>>> >> >supported"
>>> >> >
>>> >> >And for that reason we are forced to use brackets notation and
>>> >>HTMLElement
>>> >> >right?
>>> >>
>>> >> I still don't understand why you need brackets.
>>> >>
>>> >> FWIW, you can use:
>>> >>   @flexjsignorecoercion HTMLDialogElement
>>> >>
>>> >> This will get rid of the Language.as call, but I don't know what
>>> >> createElement will return.
>>> >>
>>> >> I thought you said you somehow got this to work on Safari and FF but
>>> >> couldn't call the show method without ["show"].  I still don't
>>> >>understand
>>> >> what the dialog variable is pointing to if you couldn't get past the
>>> >> createElement call.  But if Safari returns something that is an
>>> >> HTMLElement with a show method, you should be able to call
>>> dialog.show()
>>> >> if you skip the Language.as check by using @flexjsignorecoercion
>>> >>
>>> >> HTH,
>>> >> -Alex
>>> >>
>>> >>
>>> >>
>>> >
>>> >
>>> >--
>>> >
>>> >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.
>>>
>>>
>>
>>
>> --
>>
>> Carlos Rovira
>> Director General
>> M: +34 607 22 60 05 <607%2022%2060%2005>
>> 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.
>>
>>
>
>
>-- 
>
>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.

Mime
View raw message