lib/assets/javascripts/up/syntax.js.coffee in upjs-rails-0.18.0 vs lib/assets/javascripts/up/syntax.js.coffee in upjs-rails-0.18.1

- old
+ new

@@ -193,11 +193,10 @@ The destructor is *not* expected to remove the element from the DOM, which is already handled by [`up.destroy`](/up.destroy). @stable ### compilers = [] - defaultCompilers = null compiler = (selector, args...) -> # Silently discard any compilers that are registered on unsupported browsers return unless up.browser.isSupported() compiler = args.pop() @@ -206,25 +205,26 @@ selector: selector callback: compiler batch: options.batch applyCompiler = (compiler, $jqueryElement, nativeElement) -> - u.debug "Applying compiler %o on %o", compiler.selector, nativeElement + up.puts ("Compiling '%s' on %o" unless compiler.isDefault), compiler.selector, nativeElement destroyer = compiler.callback.apply(nativeElement, [$jqueryElement, data($jqueryElement)]) if u.isFunction(destroyer) $jqueryElement.addClass(DESTROYABLE_CLASS) $jqueryElement.data(DESTROYER_KEY, destroyer) compile = ($fragment) -> - u.debug "Compiling fragment %o", $fragment - for compiler in compilers - $matches = u.findWithSelf($fragment, compiler.selector) - if $matches.length - if compiler.batch - applyCompiler(compiler, $matches, $matches.get()) - else - $matches.each -> applyCompiler(compiler, $(this), this) + up.log.group "Compiling fragment %o", $fragment.get(0), -> + for compiler in compilers + $matches = u.findWithSelf($fragment, compiler.selector) + if $matches.length + up.log.group ("Compiling '%s' on %d element(s)" unless compiler.isDefault), compiler.selector, $matches.length, -> + if compiler.batch + applyCompiler(compiler, $matches, $matches.get()) + else + $matches.each -> applyCompiler(compiler, $(this), this) runDestroyers = ($fragment) -> u.findWithSelf($fragment, ".#{DESTROYABLE_CLASS}").each -> $element = $(this) destroyer = $element.data(DESTROYER_KEY) @@ -272,20 +272,21 @@ to later be restored through `reset`. @internal ### snapshot = -> - defaultCompilers = u.copy(compilers) + for compiler in compilers + compiler.isDefault = true ###* Resets the list of registered compiler directives to the moment when the framework was booted. @internal ### reset = -> - compilers = u.copy(defaultCompilers) + compilers = u.select compilers, (compiler) -> compiler.isDefault ###* Compiles a page fragment that has been inserted into the DOM without Up.js. @@ -309,10 +310,12 @@ The compiled element @stable ### hello = (selectorOrElement, options) -> $element = $(selectorOrElement) - eventAttrs = u.options(options, $element: $element) + eventAttrs = u.options options, + $element: $element + message: ['Inserted fragment %o', $element.get(0)] up.emit('up:fragment:inserted', eventAttrs) $element ###* When a page fragment has been [inserted or updated](/up.replace),