Esempio n. 1
0
        base: function (type, opts, other) {
            var attrs = conv(opts)
            var s = _.isString(type) ? split(type) : {}

            // grab slot from attrs, and remove it!
            var slot = attrs.Slot
            delete attrs.Slot

            var id = attrs.Id
            delete attrs.Id

            var klass = attrs.Class
            if (klass) {
                if (_.isString(klass)) {
                    klass = klass.split(' ')
                }
            }
            delete attrs.Class

            if (s.type) type = s.type;
            if (s.class) klass = s.class;
            if (s.id) attrs.Id = s.id;

            return _.extend({
                type: type,
                id: id,
                'class': klass,
                attrs: attrs,
                slot: slot,
                $link: opts.$link,
                $unlink : opts.$unlink
            }, other || {});
        },
Esempio n. 2
0
    function Style(id, attrs) {
        var s = split(id)
        var doc = {
            class: s.class,
            type: s.type,
            attrs: _.clone(conv(attrs)) || { id: s.id },
            children: Array.prototype.slice.call(arguments, 2)
        };


        return doc
    }