Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292418

Use <mark> element for 'mark' theme hook

$
0
0

Current theme function

Located in includes/theme.inc:

function theme_mark($variables) {
  $type = $variables['type'];
  global $user;
  if ($user->uid) {
    if ($type == MARK_NEW) {
      return '<span class="marker">' . t('new') . '</span>';
    }
    elseif ($type == MARK_UPDATED) {
      return '<span class="marker">' . t('updated') . '</span>';
    }
  }
}

Potential Changes

  • The tag should be changed to <mark>.
  • The class should be removed. It's superflous. The element speaks for itself and context can be derived from the wrapper.
  • The core/theme CSS needs to adjusted where targeting .marker. <mark> element has a yellow background and black foreground by default so we can remove the core styling from system.theme.css and style it however in the core themes, if at all.
  • The code itself could be cleaned up and simplified. Maybe it could take the string as an argument instead of dealing with constants. I say this because there are other places where it could be used easier if that were the case, such as comment.tpl.php:
    <?php if ($new): ?>
        <span class="new"><?php print $new ?></span>
      <?php endif; ?>
    

When to Use the MARK Element

  • Showing search results
  • Highlight text in a quotation
  • Indicate new items in a list
  • Show the current date in a calendar
  • Highlighting an error

References

http://webdesign.about.com/od/html5tags/a/understanding-the-mark-element...
https://www.w3.org/wiki/HTML/Elements/mark
https://developer.mozilla.org/en/docs/Web/HTML/Element/mark


Viewing all articles
Browse latest Browse all 292418

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>