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.
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.
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.