mozilla

Revision 172039 of JavaScript Tips

  • Revision slug: Talk:JavaScript_Tips
  • Revision title: JavaScript Tips
  • Revision id: 172039
  • Created:
  • Creator: Np
  • Is current revision? No
  • Comment Moving from KB

Revision Content

  • "The character set for XUL, DTD, script, and properties files is UTF-8 which is not easily readable."
    • This needs explanation. "Not easily readable" sounds weird. How is DTD being UTF-8 related to \uXXXX escapes?
  • "Convenience constants for interface names should be prefixed with nsI"
    • This makes little sense for mozI interfaces. Are the short names like nsIWBP a good idea anyway?
  • "Duplicate variable declaration"
    • This is not a JS strict warning anymore (iirc ben lobbied for that, need to find a bug and update the text in the article)

--Nickolay 14:30, 9 June 2006 (PDT)

Moving from KB

I'm looking into moving the info from this KB article here. There are two things that page has that this doesn't, and I'm not sure whether these are actual guidelines in use.

  • Private members should start with _
  • Unique prefixes or enclosing functions with a uniquely-named object (more important to extension developers?)

--Np 15:51, 31 August 2006 (PDT)

Revision Source

<ul><li> "The character set for XUL, DTD, script, and properties files is UTF-8 which is not easily readable."
<ul><li> This needs explanation. "Not easily readable" sounds weird. How is DTD being UTF-8 related to \uXXXX escapes?
</li></ul>
</li><li> "Convenience constants for interface names should be prefixed with nsI"
<ul><li> This makes little sense for mozI interfaces. Are the short names like nsIWBP a good idea anyway?
</li></ul>
</li><li> "Duplicate variable declaration"
<ul><li> This is not a JS strict warning anymore (iirc ben lobbied for that, need to find a bug and update the text in the article)
</li></ul>
</li></ul>
<p>--<a href="User:Nickolay">Nickolay</a> 14:30, 9 June 2006 (PDT)
</p>
<h3 name="Moving_from_KB">Moving from KB</h3>
<p>I'm looking into moving the info from <a class="external" href="http://kb.mozillazine.org/JavaScript_coding_guidelines">this KB article</a> here. There are two things that page has that this doesn't, and I'm not sure whether these are actual guidelines in use.
</p>
<ul><li> Private members should start with _
</li><li> Unique prefixes or enclosing functions with a uniquely-named object (more important to extension developers?)
</li></ul>
<p>--<a href="User:Np">Np</a> 15:51, 31 August 2006 (PDT)
</p>
Revert to this revision