Null values in fwAddJToTag fails to create the attribute

I was looking at my Anti Spam action code recently and found that the following code failed to generate anything in the resulting HTML;
myiframe.fwAddJToTag(“src”,“”);

This wasn’t such a big deal as I was able to change this for;
myiframe.src = fwQuote(“”);

but should a null value like the first example cause the attribute not to get written? I would have thought this was a bug.
Any thoughts?
Thanks,
Tim.


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

As long as the behavior of the function has not changed between FW versions, I would consider that significant.

The fwAddJToTag, from my understanding, is more tuned for adding ‘events’ to the tag {onmouseover, onclick, etc…}, not so much ‘properties/attributes’.

If you were to do something like: fwAddJToTag(‘onclick’,‘clickEvent();’), then it would take this input, look at the the tag to which it is applied, find any previous instance of ‘onclick’ and make sure that it fell into place before any found ‘return true|false;’ statements. Whereas the myTag.src=clickEvent(); approach is ‘dumb’ in the sense that it will blindly overwrite any present value with its own.

In your example case: (A) It cannot find an existing ‘src’ tag (B) in which to search for any existing ‘return true|false’ statements (C) before which to add your empty string value. Not that that is exactly the ‘thought’ behind the method, but the null example fails all three points. Besides, what value is an ‘event’ with no content?

With this in mind, it is not surprising that the function ‘fails’ as you describe. My impression is that this is acceptable behavior, since the method could be used as a built-in conditional with the actual ‘value’ portion fed by the output from another function inside the Action.

((Info for general public, not targeted at you Tim:))
This method is covered in FW’s Action JS Reference .pdf:
http://www.softpress.com/support/actions/Writing_Actions/index.php


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks for the considered reply Weaver. I’m just glad I don’t need to file a
bug! :wink:
Regards,
Tim.

Quoting Weaver email@hidden:

As long as the behavior of the function has not changed between FW versions,
I would consider that significant.

The fwAddJToTag, from my understanding, is more tuned for adding ‘events’ to
the tag {onmouseover, onclick, etc…}, not so much ‘properties/attributes’.

If you were to do something like: fwAddJToTag(‘onclick’,‘clickEvent();’),
then it would take this input, look at the the tag to which it is applied,
find any previous instance of ‘onclick’ and make sure that it fell into place
before any found ‘return true|false;’ statements. Whereas the
myTag.src=clickEvent(); approach is ‘dumb’ in the sense that it will blindly
overwrite any present value with its own.

In your example case: (A) It cannot find an existing ‘src’ tag (B) in which
to search for any existing ‘return true|false’ statements (C) before which to
add your empty string value. Not that that is exactly the ‘thought’ behind
the method, but the null example fails all three points. Besides, what value
is an ‘event’ with no content?

With this in mind, it is not surprising that the function ‘fails’ as you
describe. My impression is that this is acceptable behavior, since the
method could be used as a built-in conditional with the actual ‘value’
portion fed by the output from another function inside the Action.

((Info for general public, not targeted at you Tim:))
This method is covered in FW’s Action JS Reference .pdf:
http://www.softpress.com/support/actions/Writing_Actions/index.php


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


Extend Freeway the way you want with FreewayActions.com
http://www.freewayactions.com


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options