Hi Danielo

The getAttribute() method doesn't consider the empty string to be a missing
attribute, and so does not apply the default. This is by design because
there are situations where a blank string is not the same as a missing
attribute. If you do want to consider the empty string to be a missing
attribute then you can use the workaround you suggest.

Best wishes

Jeremy.



On Wed, Apr 16, 2014 at 10:34 AM, Danielo Rodríguez <[email protected]>wrote:

> Hello
>
> I'm facing some problems, easy to resolve but problems at all, because the
> behavior of the getAttribute method.
> getAttribute returns the property or the default value defined as the
> second parameter. The problem is when the property is an empty string. I
> expect to get the default value in that case but I get the empty string.
>
> This makes this kind of sentences useless
>
>       this.pluginName=this.getAttribute("name","aPlugin");
>
> And I will be forced to use always this as an alternative
>
>       this.pluginName=this.getAttribute("name") || "default value";
>
>
> In my opinion this should be handled within the method.
> Regards.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWikiDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/tiddlywikidev.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jeremy Ruston
mailto:[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to