You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Jim Norris <ji...@e-work.com> on 2017/07/30 18:56:20 UTC

XML hasOwnProperty method

This may be for Harbs as I think he did a lot of the work for XML.

 

I am working on some existing Flex code and trying to convert portions of it
to FlexJS.  As part of the application it loads a lot of XML files and uses
E4X to parse them.  I was able to get this working quickly in swf format, so
that was awesome!

 

However, I am having a problem with the hasOwnProperty method.  It works
fine running in swf format, but when I export to HTML/JS the Javascript
bombs on the hasOwnProperty method calls.  If I remove them the code
executes as it should.

 

I checked here
(https://cwiki.apache.org/confluence/display/FLEX/E4X+Observations) and it
seems like they should be working but I wanted to check if I am doing
something I should not.

 

 

Typically these checks look like this in AS:

 

if (resourceXML.hasOwnProperty("@collapsible") == true){

globalCollapsible = toBoolean(resourceXML.@collapsible);

}else{

      _globalCollapsible = false;

}

 

And look like this in the JS (the last alert I message I see is the
'checking global property'):

 

  alert('TextViewer checking global property');

  if (resourceXML.hasOwnProperty("@collapsible") == true) {

                alert('TextViewer.init found global property');

    this._globalCollapsible =
this.toBoolean(resourceXML.attribute('collapsible'));

  } else {

                alert('TextViewer.init global property not found');

    this._globalCollapsible = false;

  }

 

 

I have a ton of these types of checks in my code so any insight you may have
into either 1) what is wrong, or 2) what I should do instead would be a lot
of help.

 

 

Thanks,

 

Jim


RE: XML hasOwnProperty method

Posted by Jim Norris <ji...@e-work.com>.
Thanks, I will give it a try today.

-----Original Message-----
From: Harbs [mailto:harbs.lists@gmail.com] 
Sent: Friday, August 4, 2017 8:20 AM
To: dev@flex.apache.org
Subject: Re: XML hasOwnProperty method

I just committed some code which I think fixes IE.

Harbs

> On Jul 31, 2017, at 11:40 PM, Jim Norris <ji...@e-work.com> wrote:
> 
> Hi-
> 
> I installed the Apache FlexJS Nightly using the SDK Installer and adjusted the project compiler to the new SDK, but I am still seeing failures with the handleOwnProperty method.  I will try to do some additional debugging tomorrow to see where the problem is coming from.
> 
> In the meantime I used the work around you mentioned and got a component working correctly in Firefox.  However, I am getting a syntax error in Internet Explorer when creating the XML object (the same function works in Firefox, both using the same XML file).  Specifically the issue is at this line in XML.js:
> 
> var /** @type {string} */ errorNS = 
> org.apache.flex.utils.Language.string(parser.parseFromString('<', 
> 'application/xml').getElementsByTagName("parsererror")[0].namespaceURI
> );
> 
> In Firefox this line works without issue, but in IE I see a syntax error in the debugger.
> 
> I did a little research and it seems this may be an issue specific to IE11, although it is a little unclear to me how best to fix it.
> 
> https://stackoverflow.com/questions/23022956/internet-explorer-11-ie-1
> 1-throws-syntax-error-using-parsefromstring-in-dompar
> https://stackoverflow.com/questions/31277058/parsefromstring-throws-er
> ror-in-ie-but-not-in-chrome?noredirect=1&lq=1
> 
> Let me know if I can provide any additional info.
> 
> 
> 
> 
> Thanks,
> 
> Jim
> 
> -----Original Message-----
> From: Harbs [mailto:harbs.lists@gmail.com]
> Sent: Sunday, July 30, 2017 4:37 PM
> To: dev@flex.apache.org
> Subject: Re: XML hasOwnProperty method
> 
> There are quite a few fixes to XML in particular in the nightly, so I would recommend that you use the nightly anyway.
> 
> If you need help getting the nightly, let us know.
> 
> Thanks,
> Harbs
> 
>> On Jul 30, 2017, at 11:05 PM, Jim Norris <ji...@e-work.com> wrote:
>> 
>> That's great news!  I am using 0.8 right now although I may need to get this update to be able to progress much further.
>> 
>> 
>> 
>> Thanks,
>> 
>> Jim
>> 
>> -----Original Message-----
>> From: Harbs [mailto:harbs.lists@gmail.com]
>> Sent: Sunday, July 30, 2017 3:47 PM
>> To: dev@flex.apache.org
>> Subject: Re: XML hasOwnProperty method
>> 
>> I just tried this and I see the problem.
>> 
>> I should have it fixed soon…
>> 
>>> On Jul 30, 2017, at 10:38 PM, Harbs <ha...@gmail.com> wrote:
>>> 
>>> Hi Jim,
>>> 
>>> Do you get some kind of error when you do this? Are you using 0.8.0 or the nightly?
>>> 
>>> I don’t think hasOwnProperty is something I personally use, so I wouldn’t be too surprised if there are issues there.
>>> 
>>> (FWIW, you should be able to use
>>> if(resourceXML.@collapsible.length())
>>> as a workaround.)
>>> 
>>> Thanks,
>>> Harbs
>>> 
>>>> On Jul 30, 2017, at 9:56 PM, Jim Norris <ji...@e-work.com> wrote:
>>>> 
>>>> This may be for Harbs as I think he did a lot of the work for XML.
>>>> 
>>>> 
>>>> 
>>>> I am working on some existing Flex code and trying to convert 
>>>> portions of it to FlexJS.  As part of the application it loads a 
>>>> lot of XML files and uses E4X to parse them.  I was able to get 
>>>> this working quickly in swf format, so that was awesome!
>>>> 
>>>> 
>>>> 
>>>> However, I am having a problem with the hasOwnProperty method.  It 
>>>> works fine running in swf format, but when I export to HTML/JS the 
>>>> Javascript bombs on the hasOwnProperty method calls.  If I remove 
>>>> them the code executes as it should.
>>>> 
>>>> 
>>>> 
>>>> I checked here
>>>> (https://cwiki.apache.org/confluence/display/FLEX/E4X+Observations)
>>>> and it seems like they should be working but I wanted to check if I 
>>>> am doing something I should not.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Typically these checks look like this in AS:
>>>> 
>>>> 
>>>> 
>>>> if (resourceXML.hasOwnProperty("@collapsible") == true){
>>>> 
>>>> globalCollapsible = toBoolean(resourceXML.@collapsible);
>>>> 
>>>> }else{
>>>> 
>>>>   _globalCollapsible = false;
>>>> 
>>>> }
>>>> 
>>>> 
>>>> 
>>>> And look like this in the JS (the last alert I message I see is the 
>>>> 'checking global property'):
>>>> 
>>>> 
>>>> 
>>>> alert('TextViewer checking global property');
>>>> 
>>>> if (resourceXML.hasOwnProperty("@collapsible") == true) {
>>>> 
>>>>             alert('TextViewer.init found global property');
>>>> 
>>>> this._globalCollapsible =
>>>> this.toBoolean(resourceXML.attribute('collapsible'));
>>>> 
>>>> } else {
>>>> 
>>>>             alert('TextViewer.init global property not found');
>>>> 
>>>> this._globalCollapsible = false;
>>>> 
>>>> }
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> I have a ton of these types of checks in my code so any insight you 
>>>> may have into either 1) what is wrong, or 2) what I should do 
>>>> instead would be a lot of help.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Thanks,
>>>> 
>>>> 
>>>> 
>>>> Jim
>>>> 
>>> 
>> 
>> 
> 
> 



Re: XML hasOwnProperty method

Posted by Harbs <ha...@gmail.com>.
I just committed some code which I think fixes IE.

Harbs

> On Jul 31, 2017, at 11:40 PM, Jim Norris <ji...@e-work.com> wrote:
> 
> Hi-
> 
> I installed the Apache FlexJS Nightly using the SDK Installer and adjusted the project compiler to the new SDK, but I am still seeing failures with the handleOwnProperty method.  I will try to do some additional debugging tomorrow to see where the problem is coming from.
> 
> In the meantime I used the work around you mentioned and got a component working correctly in Firefox.  However, I am getting a syntax error in Internet Explorer when creating the XML object (the same function works in Firefox, both using the same XML file).  Specifically the issue is at this line in XML.js:
> 
> var /** @type {string} */ errorNS = org.apache.flex.utils.Language.string(parser.parseFromString('<', 'application/xml').getElementsByTagName("parsererror")[0].namespaceURI);
> 
> In Firefox this line works without issue, but in IE I see a syntax error in the debugger.
> 
> I did a little research and it seems this may be an issue specific to IE11, although it is a little unclear to me how best to fix it.
> 
> https://stackoverflow.com/questions/23022956/internet-explorer-11-ie-11-throws-syntax-error-using-parsefromstring-in-dompar
> https://stackoverflow.com/questions/31277058/parsefromstring-throws-error-in-ie-but-not-in-chrome?noredirect=1&lq=1
> 
> Let me know if I can provide any additional info.
> 
> 
> 
> 
> Thanks,
> 
> Jim
> 
> -----Original Message-----
> From: Harbs [mailto:harbs.lists@gmail.com] 
> Sent: Sunday, July 30, 2017 4:37 PM
> To: dev@flex.apache.org
> Subject: Re: XML hasOwnProperty method
> 
> There are quite a few fixes to XML in particular in the nightly, so I would recommend that you use the nightly anyway.
> 
> If you need help getting the nightly, let us know.
> 
> Thanks,
> Harbs
> 
>> On Jul 30, 2017, at 11:05 PM, Jim Norris <ji...@e-work.com> wrote:
>> 
>> That's great news!  I am using 0.8 right now although I may need to get this update to be able to progress much further.
>> 
>> 
>> 
>> Thanks,
>> 
>> Jim
>> 
>> -----Original Message-----
>> From: Harbs [mailto:harbs.lists@gmail.com]
>> Sent: Sunday, July 30, 2017 3:47 PM
>> To: dev@flex.apache.org
>> Subject: Re: XML hasOwnProperty method
>> 
>> I just tried this and I see the problem.
>> 
>> I should have it fixed soon…
>> 
>>> On Jul 30, 2017, at 10:38 PM, Harbs <ha...@gmail.com> wrote:
>>> 
>>> Hi Jim,
>>> 
>>> Do you get some kind of error when you do this? Are you using 0.8.0 or the nightly?
>>> 
>>> I don’t think hasOwnProperty is something I personally use, so I wouldn’t be too surprised if there are issues there.
>>> 
>>> (FWIW, you should be able to use 
>>> if(resourceXML.@collapsible.length())
>>> as a workaround.)
>>> 
>>> Thanks,
>>> Harbs
>>> 
>>>> On Jul 30, 2017, at 9:56 PM, Jim Norris <ji...@e-work.com> wrote:
>>>> 
>>>> This may be for Harbs as I think he did a lot of the work for XML.
>>>> 
>>>> 
>>>> 
>>>> I am working on some existing Flex code and trying to convert 
>>>> portions of it to FlexJS.  As part of the application it loads a lot 
>>>> of XML files and uses E4X to parse them.  I was able to get this 
>>>> working quickly in swf format, so that was awesome!
>>>> 
>>>> 
>>>> 
>>>> However, I am having a problem with the hasOwnProperty method.  It 
>>>> works fine running in swf format, but when I export to HTML/JS the 
>>>> Javascript bombs on the hasOwnProperty method calls.  If I remove 
>>>> them the code executes as it should.
>>>> 
>>>> 
>>>> 
>>>> I checked here
>>>> (https://cwiki.apache.org/confluence/display/FLEX/E4X+Observations)
>>>> and it seems like they should be working but I wanted to check if I 
>>>> am doing something I should not.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Typically these checks look like this in AS:
>>>> 
>>>> 
>>>> 
>>>> if (resourceXML.hasOwnProperty("@collapsible") == true){
>>>> 
>>>> globalCollapsible = toBoolean(resourceXML.@collapsible);
>>>> 
>>>> }else{
>>>> 
>>>>   _globalCollapsible = false;
>>>> 
>>>> }
>>>> 
>>>> 
>>>> 
>>>> And look like this in the JS (the last alert I message I see is the 
>>>> 'checking global property'):
>>>> 
>>>> 
>>>> 
>>>> alert('TextViewer checking global property');
>>>> 
>>>> if (resourceXML.hasOwnProperty("@collapsible") == true) {
>>>> 
>>>>             alert('TextViewer.init found global property');
>>>> 
>>>> this._globalCollapsible =
>>>> this.toBoolean(resourceXML.attribute('collapsible'));
>>>> 
>>>> } else {
>>>> 
>>>>             alert('TextViewer.init global property not found');
>>>> 
>>>> this._globalCollapsible = false;
>>>> 
>>>> }
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> I have a ton of these types of checks in my code so any insight you 
>>>> may have into either 1) what is wrong, or 2) what I should do 
>>>> instead would be a lot of help.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Thanks,
>>>> 
>>>> 
>>>> 
>>>> Jim
>>>> 
>>> 
>> 
>> 
> 
> 


Re: XML hasOwnProperty method

Posted by Harbs <ha...@gmail.com>.
Take a look in XML.js in your js-debug folder.

XML.prototype.toAttributeName should look like this:

XML.prototype.toAttributeName = function(name) {
  var /** @type {QName} */ qname;
  if (!org.apache.flex.utils.Language.is(name, QName)) {
    name = name.toString();
    if (name.indexOf("@") > -1)
      name = name.substring(name.indexOf("@") + 1);
  }
  qname = this.toXMLName(name);
  qname.isAttribute = true;
  return qname;
};

If it does not, one of two things are wrong:
1. You did not clean your build before using the new SDK. To fix that, just deleting the js-debug folder should be enough.
2. The SDK does not have the changes. If that’s the case, we’ll have to figure out why.

If XML.prototype.toAttributeName does look like the above, there might be something else wrong and I might need your xml to figure out what. The error stack trace would probably be helpful as well.

As far as IE goes: Yes. That’s on my to-do list. My main development machine is a Mac, so debugging for IE is a bit of a pain. That’s why I’ve been putting it off. I’ll probably get to that sometime over the next week or so.

> On Jul 31, 2017, at 11:40 PM, Jim Norris <ji...@e-work.com> wrote:
> 
> Hi-
> 
> I installed the Apache FlexJS Nightly using the SDK Installer and adjusted the project compiler to the new SDK, but I am still seeing failures with the handleOwnProperty method.  I will try to do some additional debugging tomorrow to see where the problem is coming from.
> 
> In the meantime I used the work around you mentioned and got a component working correctly in Firefox.  However, I am getting a syntax error in Internet Explorer when creating the XML object (the same function works in Firefox, both using the same XML file).  Specifically the issue is at this line in XML.js:
> 
> var /** @type {string} */ errorNS = org.apache.flex.utils.Language.string(parser.parseFromString('<', 'application/xml').getElementsByTagName("parsererror")[0].namespaceURI);
> 
> In Firefox this line works without issue, but in IE I see a syntax error in the debugger.
> 
> I did a little research and it seems this may be an issue specific to IE11, although it is a little unclear to me how best to fix it.
> 
> https://stackoverflow.com/questions/23022956/internet-explorer-11-ie-11-throws-syntax-error-using-parsefromstring-in-dompar
> https://stackoverflow.com/questions/31277058/parsefromstring-throws-error-in-ie-but-not-in-chrome?noredirect=1&lq=1
> 
> Let me know if I can provide any additional info.
> 
> 
> 
> 
> Thanks,
> 
> Jim
> 
> -----Original Message-----
> From: Harbs [mailto:harbs.lists@gmail.com] 
> Sent: Sunday, July 30, 2017 4:37 PM
> To: dev@flex.apache.org
> Subject: Re: XML hasOwnProperty method
> 
> There are quite a few fixes to XML in particular in the nightly, so I would recommend that you use the nightly anyway.
> 
> If you need help getting the nightly, let us know.
> 
> Thanks,
> Harbs
> 
>> On Jul 30, 2017, at 11:05 PM, Jim Norris <ji...@e-work.com> wrote:
>> 
>> That's great news!  I am using 0.8 right now although I may need to get this update to be able to progress much further.
>> 
>> 
>> 
>> Thanks,
>> 
>> Jim
>> 
>> -----Original Message-----
>> From: Harbs [mailto:harbs.lists@gmail.com]
>> Sent: Sunday, July 30, 2017 3:47 PM
>> To: dev@flex.apache.org
>> Subject: Re: XML hasOwnProperty method
>> 
>> I just tried this and I see the problem.
>> 
>> I should have it fixed soon…
>> 
>>> On Jul 30, 2017, at 10:38 PM, Harbs <ha...@gmail.com> wrote:
>>> 
>>> Hi Jim,
>>> 
>>> Do you get some kind of error when you do this? Are you using 0.8.0 or the nightly?
>>> 
>>> I don’t think hasOwnProperty is something I personally use, so I wouldn’t be too surprised if there are issues there.
>>> 
>>> (FWIW, you should be able to use 
>>> if(resourceXML.@collapsible.length())
>>> as a workaround.)
>>> 
>>> Thanks,
>>> Harbs
>>> 
>>>> On Jul 30, 2017, at 9:56 PM, Jim Norris <ji...@e-work.com> wrote:
>>>> 
>>>> This may be for Harbs as I think he did a lot of the work for XML.
>>>> 
>>>> 
>>>> 
>>>> I am working on some existing Flex code and trying to convert 
>>>> portions of it to FlexJS.  As part of the application it loads a lot 
>>>> of XML files and uses E4X to parse them.  I was able to get this 
>>>> working quickly in swf format, so that was awesome!
>>>> 
>>>> 
>>>> 
>>>> However, I am having a problem with the hasOwnProperty method.  It 
>>>> works fine running in swf format, but when I export to HTML/JS the 
>>>> Javascript bombs on the hasOwnProperty method calls.  If I remove 
>>>> them the code executes as it should.
>>>> 
>>>> 
>>>> 
>>>> I checked here
>>>> (https://cwiki.apache.org/confluence/display/FLEX/E4X+Observations)
>>>> and it seems like they should be working but I wanted to check if I 
>>>> am doing something I should not.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Typically these checks look like this in AS:
>>>> 
>>>> 
>>>> 
>>>> if (resourceXML.hasOwnProperty("@collapsible") == true){
>>>> 
>>>> globalCollapsible = toBoolean(resourceXML.@collapsible);
>>>> 
>>>> }else{
>>>> 
>>>>   _globalCollapsible = false;
>>>> 
>>>> }
>>>> 
>>>> 
>>>> 
>>>> And look like this in the JS (the last alert I message I see is the 
>>>> 'checking global property'):
>>>> 
>>>> 
>>>> 
>>>> alert('TextViewer checking global property');
>>>> 
>>>> if (resourceXML.hasOwnProperty("@collapsible") == true) {
>>>> 
>>>>             alert('TextViewer.init found global property');
>>>> 
>>>> this._globalCollapsible =
>>>> this.toBoolean(resourceXML.attribute('collapsible'));
>>>> 
>>>> } else {
>>>> 
>>>>             alert('TextViewer.init global property not found');
>>>> 
>>>> this._globalCollapsible = false;
>>>> 
>>>> }
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> I have a ton of these types of checks in my code so any insight you 
>>>> may have into either 1) what is wrong, or 2) what I should do 
>>>> instead would be a lot of help.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Thanks,
>>>> 
>>>> 
>>>> 
>>>> Jim
>>>> 
>>> 
>> 
>> 
> 
> 


RE: XML hasOwnProperty method

Posted by Jim Norris <ji...@e-work.com>.
Hi-

I installed the Apache FlexJS Nightly using the SDK Installer and adjusted the project compiler to the new SDK, but I am still seeing failures with the handleOwnProperty method.  I will try to do some additional debugging tomorrow to see where the problem is coming from.

In the meantime I used the work around you mentioned and got a component working correctly in Firefox.  However, I am getting a syntax error in Internet Explorer when creating the XML object (the same function works in Firefox, both using the same XML file).  Specifically the issue is at this line in XML.js:

var /** @type {string} */ errorNS = org.apache.flex.utils.Language.string(parser.parseFromString('<', 'application/xml').getElementsByTagName("parsererror")[0].namespaceURI);

In Firefox this line works without issue, but in IE I see a syntax error in the debugger.

I did a little research and it seems this may be an issue specific to IE11, although it is a little unclear to me how best to fix it.

https://stackoverflow.com/questions/23022956/internet-explorer-11-ie-11-throws-syntax-error-using-parsefromstring-in-dompar
https://stackoverflow.com/questions/31277058/parsefromstring-throws-error-in-ie-but-not-in-chrome?noredirect=1&lq=1

Let me know if I can provide any additional info.




Thanks,

Jim

-----Original Message-----
From: Harbs [mailto:harbs.lists@gmail.com] 
Sent: Sunday, July 30, 2017 4:37 PM
To: dev@flex.apache.org
Subject: Re: XML hasOwnProperty method

There are quite a few fixes to XML in particular in the nightly, so I would recommend that you use the nightly anyway.

If you need help getting the nightly, let us know.

Thanks,
Harbs

> On Jul 30, 2017, at 11:05 PM, Jim Norris <ji...@e-work.com> wrote:
> 
> That's great news!  I am using 0.8 right now although I may need to get this update to be able to progress much further.
> 
> 
> 
> Thanks,
> 
> Jim
> 
> -----Original Message-----
> From: Harbs [mailto:harbs.lists@gmail.com]
> Sent: Sunday, July 30, 2017 3:47 PM
> To: dev@flex.apache.org
> Subject: Re: XML hasOwnProperty method
> 
> I just tried this and I see the problem.
> 
> I should have it fixed soon…
> 
>> On Jul 30, 2017, at 10:38 PM, Harbs <ha...@gmail.com> wrote:
>> 
>> Hi Jim,
>> 
>> Do you get some kind of error when you do this? Are you using 0.8.0 or the nightly?
>> 
>> I don’t think hasOwnProperty is something I personally use, so I wouldn’t be too surprised if there are issues there.
>> 
>> (FWIW, you should be able to use 
>> if(resourceXML.@collapsible.length())
>> as a workaround.)
>> 
>> Thanks,
>> Harbs
>> 
>>> On Jul 30, 2017, at 9:56 PM, Jim Norris <ji...@e-work.com> wrote:
>>> 
>>> This may be for Harbs as I think he did a lot of the work for XML.
>>> 
>>> 
>>> 
>>> I am working on some existing Flex code and trying to convert 
>>> portions of it to FlexJS.  As part of the application it loads a lot 
>>> of XML files and uses E4X to parse them.  I was able to get this 
>>> working quickly in swf format, so that was awesome!
>>> 
>>> 
>>> 
>>> However, I am having a problem with the hasOwnProperty method.  It 
>>> works fine running in swf format, but when I export to HTML/JS the 
>>> Javascript bombs on the hasOwnProperty method calls.  If I remove 
>>> them the code executes as it should.
>>> 
>>> 
>>> 
>>> I checked here
>>> (https://cwiki.apache.org/confluence/display/FLEX/E4X+Observations)
>>> and it seems like they should be working but I wanted to check if I 
>>> am doing something I should not.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Typically these checks look like this in AS:
>>> 
>>> 
>>> 
>>> if (resourceXML.hasOwnProperty("@collapsible") == true){
>>> 
>>> globalCollapsible = toBoolean(resourceXML.@collapsible);
>>> 
>>> }else{
>>> 
>>>    _globalCollapsible = false;
>>> 
>>> }
>>> 
>>> 
>>> 
>>> And look like this in the JS (the last alert I message I see is the 
>>> 'checking global property'):
>>> 
>>> 
>>> 
>>> alert('TextViewer checking global property');
>>> 
>>> if (resourceXML.hasOwnProperty("@collapsible") == true) {
>>> 
>>>              alert('TextViewer.init found global property');
>>> 
>>>  this._globalCollapsible =
>>> this.toBoolean(resourceXML.attribute('collapsible'));
>>> 
>>> } else {
>>> 
>>>              alert('TextViewer.init global property not found');
>>> 
>>>  this._globalCollapsible = false;
>>> 
>>> }
>>> 
>>> 
>>> 
>>> 
>>> 
>>> I have a ton of these types of checks in my code so any insight you 
>>> may have into either 1) what is wrong, or 2) what I should do 
>>> instead would be a lot of help.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Thanks,
>>> 
>>> 
>>> 
>>> Jim
>>> 
>> 
> 
> 



Re: XML hasOwnProperty method

Posted by Harbs <ha...@gmail.com>.
There are quite a few fixes to XML in particular in the nightly, so I would recommend that you use the nightly anyway.

If you need help getting the nightly, let us know.

Thanks,
Harbs

> On Jul 30, 2017, at 11:05 PM, Jim Norris <ji...@e-work.com> wrote:
> 
> That's great news!  I am using 0.8 right now although I may need to get this update to be able to progress much further.
> 
> 
> 
> Thanks,
> 
> Jim
> 
> -----Original Message-----
> From: Harbs [mailto:harbs.lists@gmail.com] 
> Sent: Sunday, July 30, 2017 3:47 PM
> To: dev@flex.apache.org
> Subject: Re: XML hasOwnProperty method
> 
> I just tried this and I see the problem.
> 
> I should have it fixed soon…
> 
>> On Jul 30, 2017, at 10:38 PM, Harbs <ha...@gmail.com> wrote:
>> 
>> Hi Jim,
>> 
>> Do you get some kind of error when you do this? Are you using 0.8.0 or the nightly?
>> 
>> I don’t think hasOwnProperty is something I personally use, so I wouldn’t be too surprised if there are issues there.
>> 
>> (FWIW, you should be able to use if(resourceXML.@collapsible.length()) 
>> as a workaround.)
>> 
>> Thanks,
>> Harbs
>> 
>>> On Jul 30, 2017, at 9:56 PM, Jim Norris <ji...@e-work.com> wrote:
>>> 
>>> This may be for Harbs as I think he did a lot of the work for XML.
>>> 
>>> 
>>> 
>>> I am working on some existing Flex code and trying to convert 
>>> portions of it to FlexJS.  As part of the application it loads a lot 
>>> of XML files and uses E4X to parse them.  I was able to get this 
>>> working quickly in swf format, so that was awesome!
>>> 
>>> 
>>> 
>>> However, I am having a problem with the hasOwnProperty method.  It 
>>> works fine running in swf format, but when I export to HTML/JS the 
>>> Javascript bombs on the hasOwnProperty method calls.  If I remove 
>>> them the code executes as it should.
>>> 
>>> 
>>> 
>>> I checked here
>>> (https://cwiki.apache.org/confluence/display/FLEX/E4X+Observations) 
>>> and it seems like they should be working but I wanted to check if I 
>>> am doing something I should not.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Typically these checks look like this in AS:
>>> 
>>> 
>>> 
>>> if (resourceXML.hasOwnProperty("@collapsible") == true){
>>> 
>>> globalCollapsible = toBoolean(resourceXML.@collapsible);
>>> 
>>> }else{
>>> 
>>>    _globalCollapsible = false;
>>> 
>>> }
>>> 
>>> 
>>> 
>>> And look like this in the JS (the last alert I message I see is the 
>>> 'checking global property'):
>>> 
>>> 
>>> 
>>> alert('TextViewer checking global property');
>>> 
>>> if (resourceXML.hasOwnProperty("@collapsible") == true) {
>>> 
>>>              alert('TextViewer.init found global property');
>>> 
>>>  this._globalCollapsible =
>>> this.toBoolean(resourceXML.attribute('collapsible'));
>>> 
>>> } else {
>>> 
>>>              alert('TextViewer.init global property not found');
>>> 
>>>  this._globalCollapsible = false;
>>> 
>>> }
>>> 
>>> 
>>> 
>>> 
>>> 
>>> I have a ton of these types of checks in my code so any insight you 
>>> may have into either 1) what is wrong, or 2) what I should do instead 
>>> would be a lot of help.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Thanks,
>>> 
>>> 
>>> 
>>> Jim
>>> 
>> 
> 
> 


RE: XML hasOwnProperty method

Posted by Jim Norris <ji...@e-work.com>.
That's great news!  I am using 0.8 right now although I may need to get this update to be able to progress much further.



Thanks,

Jim

-----Original Message-----
From: Harbs [mailto:harbs.lists@gmail.com] 
Sent: Sunday, July 30, 2017 3:47 PM
To: dev@flex.apache.org
Subject: Re: XML hasOwnProperty method

I just tried this and I see the problem.

I should have it fixed soon…

> On Jul 30, 2017, at 10:38 PM, Harbs <ha...@gmail.com> wrote:
> 
> Hi Jim,
> 
> Do you get some kind of error when you do this? Are you using 0.8.0 or the nightly?
> 
> I don’t think hasOwnProperty is something I personally use, so I wouldn’t be too surprised if there are issues there.
> 
> (FWIW, you should be able to use if(resourceXML.@collapsible.length()) 
> as a workaround.)
> 
> Thanks,
> Harbs
> 
>> On Jul 30, 2017, at 9:56 PM, Jim Norris <ji...@e-work.com> wrote:
>> 
>> This may be for Harbs as I think he did a lot of the work for XML.
>> 
>> 
>> 
>> I am working on some existing Flex code and trying to convert 
>> portions of it to FlexJS.  As part of the application it loads a lot 
>> of XML files and uses E4X to parse them.  I was able to get this 
>> working quickly in swf format, so that was awesome!
>> 
>> 
>> 
>> However, I am having a problem with the hasOwnProperty method.  It 
>> works fine running in swf format, but when I export to HTML/JS the 
>> Javascript bombs on the hasOwnProperty method calls.  If I remove 
>> them the code executes as it should.
>> 
>> 
>> 
>> I checked here
>> (https://cwiki.apache.org/confluence/display/FLEX/E4X+Observations) 
>> and it seems like they should be working but I wanted to check if I 
>> am doing something I should not.
>> 
>> 
>> 
>> 
>> 
>> Typically these checks look like this in AS:
>> 
>> 
>> 
>> if (resourceXML.hasOwnProperty("@collapsible") == true){
>> 
>> globalCollapsible = toBoolean(resourceXML.@collapsible);
>> 
>> }else{
>> 
>>     _globalCollapsible = false;
>> 
>> }
>> 
>> 
>> 
>> And look like this in the JS (the last alert I message I see is the 
>> 'checking global property'):
>> 
>> 
>> 
>> alert('TextViewer checking global property');
>> 
>> if (resourceXML.hasOwnProperty("@collapsible") == true) {
>> 
>>               alert('TextViewer.init found global property');
>> 
>>   this._globalCollapsible =
>> this.toBoolean(resourceXML.attribute('collapsible'));
>> 
>> } else {
>> 
>>               alert('TextViewer.init global property not found');
>> 
>>   this._globalCollapsible = false;
>> 
>> }
>> 
>> 
>> 
>> 
>> 
>> I have a ton of these types of checks in my code so any insight you 
>> may have into either 1) what is wrong, or 2) what I should do instead 
>> would be a lot of help.
>> 
>> 
>> 
>> 
>> 
>> Thanks,
>> 
>> 
>> 
>> Jim
>> 
> 



Re: XML hasOwnProperty method

Posted by Harbs <ha...@gmail.com>.
I just pushed a fix. If you know how to patch your build, you can do that.

Otherwise, the fix should be in tomorrow’s nightly.

Thanks,
Harbs

> On Jul 30, 2017, at 10:47 PM, Harbs <ha...@gmail.com> wrote:
> 
> I just tried this and I see the problem.
> 
> I should have it fixed soon…
> 
>> On Jul 30, 2017, at 10:38 PM, Harbs <ha...@gmail.com> wrote:
>> 
>> Hi Jim,
>> 
>> Do you get some kind of error when you do this? Are you using 0.8.0 or the nightly?
>> 
>> I don’t think hasOwnProperty is something I personally use, so I wouldn’t be too surprised if there are issues there.
>> 
>> (FWIW, you should be able to use if(resourceXML.@collapsible.length()) as a workaround.)
>> 
>> Thanks,
>> Harbs
>> 
>>> On Jul 30, 2017, at 9:56 PM, Jim Norris <ji...@e-work.com> wrote:
>>> 
>>> This may be for Harbs as I think he did a lot of the work for XML.
>>> 
>>> 
>>> 
>>> I am working on some existing Flex code and trying to convert portions of it
>>> to FlexJS.  As part of the application it loads a lot of XML files and uses
>>> E4X to parse them.  I was able to get this working quickly in swf format, so
>>> that was awesome!
>>> 
>>> 
>>> 
>>> However, I am having a problem with the hasOwnProperty method.  It works
>>> fine running in swf format, but when I export to HTML/JS the Javascript
>>> bombs on the hasOwnProperty method calls.  If I remove them the code
>>> executes as it should.
>>> 
>>> 
>>> 
>>> I checked here
>>> (https://cwiki.apache.org/confluence/display/FLEX/E4X+Observations) and it
>>> seems like they should be working but I wanted to check if I am doing
>>> something I should not.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Typically these checks look like this in AS:
>>> 
>>> 
>>> 
>>> if (resourceXML.hasOwnProperty("@collapsible") == true){
>>> 
>>> globalCollapsible = toBoolean(resourceXML.@collapsible);
>>> 
>>> }else{
>>> 
>>>    _globalCollapsible = false;
>>> 
>>> }
>>> 
>>> 
>>> 
>>> And look like this in the JS (the last alert I message I see is the
>>> 'checking global property'):
>>> 
>>> 
>>> 
>>> alert('TextViewer checking global property');
>>> 
>>> if (resourceXML.hasOwnProperty("@collapsible") == true) {
>>> 
>>>              alert('TextViewer.init found global property');
>>> 
>>>  this._globalCollapsible =
>>> this.toBoolean(resourceXML.attribute('collapsible'));
>>> 
>>> } else {
>>> 
>>>              alert('TextViewer.init global property not found');
>>> 
>>>  this._globalCollapsible = false;
>>> 
>>> }
>>> 
>>> 
>>> 
>>> 
>>> 
>>> I have a ton of these types of checks in my code so any insight you may have
>>> into either 1) what is wrong, or 2) what I should do instead would be a lot
>>> of help.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Thanks,
>>> 
>>> 
>>> 
>>> Jim
>>> 
>> 
> 


Re: XML hasOwnProperty method

Posted by Harbs <ha...@gmail.com>.
I just tried this and I see the problem.

I should have it fixed soon…

> On Jul 30, 2017, at 10:38 PM, Harbs <ha...@gmail.com> wrote:
> 
> Hi Jim,
> 
> Do you get some kind of error when you do this? Are you using 0.8.0 or the nightly?
> 
> I don’t think hasOwnProperty is something I personally use, so I wouldn’t be too surprised if there are issues there.
> 
> (FWIW, you should be able to use if(resourceXML.@collapsible.length()) as a workaround.)
> 
> Thanks,
> Harbs
> 
>> On Jul 30, 2017, at 9:56 PM, Jim Norris <ji...@e-work.com> wrote:
>> 
>> This may be for Harbs as I think he did a lot of the work for XML.
>> 
>> 
>> 
>> I am working on some existing Flex code and trying to convert portions of it
>> to FlexJS.  As part of the application it loads a lot of XML files and uses
>> E4X to parse them.  I was able to get this working quickly in swf format, so
>> that was awesome!
>> 
>> 
>> 
>> However, I am having a problem with the hasOwnProperty method.  It works
>> fine running in swf format, but when I export to HTML/JS the Javascript
>> bombs on the hasOwnProperty method calls.  If I remove them the code
>> executes as it should.
>> 
>> 
>> 
>> I checked here
>> (https://cwiki.apache.org/confluence/display/FLEX/E4X+Observations) and it
>> seems like they should be working but I wanted to check if I am doing
>> something I should not.
>> 
>> 
>> 
>> 
>> 
>> Typically these checks look like this in AS:
>> 
>> 
>> 
>> if (resourceXML.hasOwnProperty("@collapsible") == true){
>> 
>> globalCollapsible = toBoolean(resourceXML.@collapsible);
>> 
>> }else{
>> 
>>     _globalCollapsible = false;
>> 
>> }
>> 
>> 
>> 
>> And look like this in the JS (the last alert I message I see is the
>> 'checking global property'):
>> 
>> 
>> 
>> alert('TextViewer checking global property');
>> 
>> if (resourceXML.hasOwnProperty("@collapsible") == true) {
>> 
>>               alert('TextViewer.init found global property');
>> 
>>   this._globalCollapsible =
>> this.toBoolean(resourceXML.attribute('collapsible'));
>> 
>> } else {
>> 
>>               alert('TextViewer.init global property not found');
>> 
>>   this._globalCollapsible = false;
>> 
>> }
>> 
>> 
>> 
>> 
>> 
>> I have a ton of these types of checks in my code so any insight you may have
>> into either 1) what is wrong, or 2) what I should do instead would be a lot
>> of help.
>> 
>> 
>> 
>> 
>> 
>> Thanks,
>> 
>> 
>> 
>> Jim
>> 
> 


Re: XML hasOwnProperty method

Posted by Harbs <ha...@gmail.com>.
Hi Jim,

Do you get some kind of error when you do this? Are you using 0.8.0 or the nightly?

I don’t think hasOwnProperty is something I personally use, so I wouldn’t be too surprised if there are issues there.

(FWIW, you should be able to use if(resourceXML.@collapsible.length()) as a workaround.)

Thanks,
Harbs

> On Jul 30, 2017, at 9:56 PM, Jim Norris <ji...@e-work.com> wrote:
> 
> This may be for Harbs as I think he did a lot of the work for XML.
> 
> 
> 
> I am working on some existing Flex code and trying to convert portions of it
> to FlexJS.  As part of the application it loads a lot of XML files and uses
> E4X to parse them.  I was able to get this working quickly in swf format, so
> that was awesome!
> 
> 
> 
> However, I am having a problem with the hasOwnProperty method.  It works
> fine running in swf format, but when I export to HTML/JS the Javascript
> bombs on the hasOwnProperty method calls.  If I remove them the code
> executes as it should.
> 
> 
> 
> I checked here
> (https://cwiki.apache.org/confluence/display/FLEX/E4X+Observations) and it
> seems like they should be working but I wanted to check if I am doing
> something I should not.
> 
> 
> 
> 
> 
> Typically these checks look like this in AS:
> 
> 
> 
> if (resourceXML.hasOwnProperty("@collapsible") == true){
> 
> globalCollapsible = toBoolean(resourceXML.@collapsible);
> 
> }else{
> 
>      _globalCollapsible = false;
> 
> }
> 
> 
> 
> And look like this in the JS (the last alert I message I see is the
> 'checking global property'):
> 
> 
> 
>  alert('TextViewer checking global property');
> 
>  if (resourceXML.hasOwnProperty("@collapsible") == true) {
> 
>                alert('TextViewer.init found global property');
> 
>    this._globalCollapsible =
> this.toBoolean(resourceXML.attribute('collapsible'));
> 
>  } else {
> 
>                alert('TextViewer.init global property not found');
> 
>    this._globalCollapsible = false;
> 
>  }
> 
> 
> 
> 
> 
> I have a ton of these types of checks in my code so any insight you may have
> into either 1) what is wrong, or 2) what I should do instead would be a lot
> of help.
> 
> 
> 
> 
> 
> Thanks,
> 
> 
> 
> Jim
>