src/basis/template.js
function(source){
      var oldSource = this.source;
      if (oldSource != source)
      {
        if (typeof source == 'string')
        {
          var m = source.match(/^([a-z]+):/);
          if (m)
          {
            source = source.substr(m[0].length);

            switch (m[1])
            {
              case 'id':
                // source from script element
                source = resolveSourceByDocumentId(source);
                break;
              case 'path':
                source = getSourceByPath(source);
                break;
              default:
                /** @cut */ basis.dev.warn(namespace + '.Template.setSource: Unknown prefix ' + m[1] + ' for template source was ingnored.');
            }
          }
        }

        if (oldSource && oldSource.bindingBridge)
        {
          this.url = '';
          this.baseURI = '';
          oldSource.bindingBridge.detach(oldSource, templateSourceUpdate, this);
        }

        if (source && source.bindingBridge)
        {
          if (source.url)
          {
            this.url = source.url;
            this.baseURI = path.dirname(source.url) + '/';
          }

          source.bindingBridge.attach(source, templateSourceUpdate, this);
        }

        this.source = source;

        templateSourceUpdate.call(this);
      }
    }
function(source){
      var oldSource = this.source;
      if (oldSource != source)
      {
        if (typeof source == 'string')
        {
          var m = source.match(/^([a-z]+):/);
          if (m)
          {
            source = source.substr(m[0].length);

            switch (m[1])
            {
              case 'id':
                // source from script element
                source = resolveSourceByDocumentId(source);
                break;
              case 'path':
                source = getSourceByPath(source);
                break;
              default:
                /** @cut */ basis.dev.warn(namespace + '.Template.setSource: Unknown prefix ' + m[1] + ' for template source was ingnored.');
            }
          }
        }

        if (oldSource && oldSource.bindingBridge)
        {
          this.url = '';
          this.baseURI = '';
          oldSource.bindingBridge.detach(oldSource, templateSourceUpdate, this);
        }

        if (source && source.bindingBridge)
        {
          if (source.url)
          {
            this.url = source.url;
            this.baseURI = path.dirname(source.url) + '/';
          }

          source.bindingBridge.attach(source, templateSourceUpdate, this);
        }

        this.source = source;

        templateSourceUpdate.call(this);
      }
    }
function ( source ) { var oldSource = this . source ; if ( oldSource != source ) { if ( typeof source == 'string' ) { var m = source . match ( / ^([a-z]+): / ) ; if ( m ) { source = source . substr ( m [ 0 ] . length ) ; switch ( m [ 1 ] ) { case 'id' : // source from script element source = resolveSourceByDocumentId ( source ) ; break ; case 'path' : source = getSourceByPath ( source ) ; break ; default : /** @cut */ basis . dev . warn ( namespace + '.Template.setSource: Unknown prefix ' + m [ 1 ] + ' for template source was ingnored.' ) ; } } } if ( oldSource && oldSource . bindingBridge ) { this . url = '' ; this . baseURI = '' ; oldSource . bindingBridge . detach ( oldSource , templateSourceUpdate , this ) ; } if ( source && source . bindingBridge ) { if ( source . url ) { this . url = source . url ; this . baseURI = path . dirname ( source . url ) + '/' ; } source . bindingBridge . attach ( source , templateSourceUpdate , this ) ; } this . source = source ; templateSourceUpdate . call ( this ) ; } }
Set new content source for template.
@param {string|bb-value} source New content source for template.
Set new content source for template .