From 9b3974b826173e2a4b1d0331a5b80b07896af4ec Mon Sep 17 00:00:00 2001 From: Yuki Hattori Date: Tue, 19 Jul 2016 18:07:03 +0900 Subject: [PATCH] BugFix #18: Improved detection behavior for classes with only- prefix Exclude metadata contents from target elements of determination. --- coffee/classes/mds_markdown.coffee | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/coffee/classes/mds_markdown.coffee b/coffee/classes/mds_markdown.coffee index c3fbba0..aba28fd 100644 --- a/coffee/classes/mds_markdown.coffee +++ b/coffee/classes/mds_markdown.coffee @@ -73,14 +73,15 @@ module.exports = class MdsMarkdown $t.attr("data-#{prop}", val) $t.find('footer.slide_footer:last').text(val) if prop == 'footer' - # Detect only elements + # Detect "only-***" elements inner = $t.find('.slide > .slide_inner') + innerContents = inner.children().filter(':not(base, link, meta, noscript, script, style, template, title)') - heads = $(inner).children(':header').length - $t.addClass('only-headings') if heads > 0 && $(inner).children().length == heads + headsLength = inner.children(':header').length + $t.addClass('only-headings') if headsLength > 0 && innerContents.length == headsLength - quotes = $(inner).children('blockquote').length - $t.addClass('only-blockquotes') if quotes > 0 && $(inner).children().length == quotes + quotesLength = inner.children('blockquote').length + $t.addClass('only-blockquotes') if quotesLength > 0 && innerContents.length == quotesLength md.parsed = mdElm.html()