diff --git a/pwiki/page.js b/pwiki/page.js index 168e68b..ebac858 100755 --- a/pwiki/page.js +++ b/pwiki/page.js @@ -64,6 +64,10 @@ module.BasePage = object.Constructor('BasePage', { // root page used to clone new instances via the .clone(..) method... //root: undefined, + + // a base page to be used as a base for cloning if root is of a + // different "class"... + //__clone_base__: undefined, // NOTE: this can be inherited... //store: undefined, @@ -412,7 +416,10 @@ object.Constructor('BasePage', { // the common root... // this will make all the non-shadowed attrs set on the // root visible to all sub-pages. - : Object.create(this.root ?? this), + : Object.create( + (this.root || {}).__clone_base__ + ?? this.root + ?? this), { root: this.root ?? this, location: this.location, @@ -1197,10 +1204,13 @@ object.Constructor('pWikiPageElement', Page, { // handle dom as first argument... __init__: function(dom, ...args){ - if(dom instanceof Element){ - this.dom = dom - } else { - args.unshift(dom) } + if(typeof(Element) != 'undefined'){ + if(dom instanceof Element){ + this.dom = dom + } else { + args.unshift(dom) } } + // XXX is this the correct way to go??? + this.__clone_base__ = this.clone() return object.parentCall(pWikiPageElement.prototype.__init__, this, ...args) }, }) diff --git a/pwiki2.js b/pwiki2.js index df563a7..fb98bdf 100755 --- a/pwiki2.js +++ b/pwiki2.js @@ -6,6 +6,10 @@ * pwiki.get(..).get(..) -> pWikiPageElement object * pwiki.get(..).get(..).get(..) -> Page object * ... +* ..the problem here is trivial, we are doing Object.construct(this.root) +* in clone -- the question is what are we going to clone if .root +* is of a different type (without ending up with long inheritance +* chains)??? * * XXX BUG: .get('/*').raw hangs... * XXX add action to reset overloaded (bootstrap) pages... @@ -26,6 +30,7 @@ * - editor and interactivity * - migrate bootstrap * - store topology +* - sync and sync conf * - markdown -- DONE * - WikiWord -- DONE * - dom filter mechanics -- DONE