Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Commit

Permalink
Merge pull request #40 from yhatt/fix-centering-behavior
Browse files Browse the repository at this point in the history
Improved detection behavior for classes with "only-" prefix
  • Loading branch information
yhatt authored Jul 20, 2016
2 parents 3af6118 + 9b3974b commit 7a03713
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions coffee/classes/mds_markdown.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 7a03713

Please # to comment.