LinkPane.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. define("dijit/layout/LinkPane", [
  2. "./ContentPane",
  3. "../_TemplatedMixin",
  4. "dojo/_base/declare" // declare
  5. ], function(ContentPane, _TemplatedMixin, declare){
  6. /*=====
  7. var _TemplatedMixin = dijit._TemplatedMixin;
  8. var ContentPane = dijit.layout.ContentPane;
  9. =====*/
  10. // module:
  11. // dijit/layout/LinkPane
  12. // summary:
  13. // A ContentPane with an href where (when declared in markup)
  14. // the title is specified as innerHTML rather than as a title attribute.
  15. return declare("dijit.layout.LinkPane", [ContentPane, _TemplatedMixin], {
  16. // summary:
  17. // A ContentPane with an href where (when declared in markup)
  18. // the title is specified as innerHTML rather than as a title attribute.
  19. // description:
  20. // LinkPane is just a ContentPane that is declared in markup similarly
  21. // to an anchor. The anchor's body (the words between `<a>` and `</a>`)
  22. // become the title of the widget (used for TabContainer, AccordionContainer, etc.)
  23. // example:
  24. // | <a href="foo.html">my title</a>
  25. // I'm using a template because the user may specify the input as
  26. // <a href="foo.html">title</a>, in which case we need to get rid of the
  27. // <a> because we don't want a link.
  28. templateString: '<div class="dijitLinkPane" data-dojo-attach-point="containerNode"></div>',
  29. postMixInProperties: function(){
  30. // If user has specified node contents, they become the title
  31. // (the link must be plain text)
  32. if(this.srcNodeRef){
  33. this.title += this.srcNodeRef.innerHTML;
  34. }
  35. this.inherited(arguments);
  36. },
  37. _fillContent: function(){
  38. // Overrides _Templated._fillContent().
  39. // _Templated._fillContent() relocates srcNodeRef innerHTML to templated container node,
  40. // but in our case the srcNodeRef innerHTML is the title, so shouldn't be
  41. // copied
  42. }
  43. });
  44. });