Use <mark> element for 'mark' theme hook

Created on 16 October 2011, over 12 years ago
Updated 20 March 2023, about 1 year ago

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

Related Issues

πŸ“Œ Task
Status

Needs work

Version

10.1 ✨

Component
MarkupΒ  β†’

Last updated 5 days ago

No maintainer
Created by

πŸ‡ΊπŸ‡ΈUnited States Jacine New York

Live updates comments and jobs are added and updated live.
  • html5

    Implements and supports the use of HTML5.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡«πŸ‡·France andypost
    +++ b/core/modules/history/src/Plugin/views/field/HistoryUserTimestamp.php
    @@ -100,8 +100,15 @@ public function render(ResultRow $values) {
    +        '#access' => ($mark == MARK_NEW || $mark == MARK_UPDATED),
    
    +++ b/core/modules/system/templates/mark.html.twig
    @@ -13,10 +13,10 @@
    +{% if status is constant('MARK_NEW') %}
    ...
    +{% elseif status is constant('MARK_UPDATED') %}
    ...
    +{% elseif status is constant('MARK_READ') %}
    
    +++ b/core/themes/classy/templates/content/mark.html.twig
    @@ -13,8 +13,10 @@
       {% if status is constant('MARK_NEW') %}
    ...
       {% elseif status is constant('MARK_UPDATED') %}
    ...
    +  {% elseif status is constant('MARK_READ') %}
    
    +++ b/core/themes/stable/templates/content/mark.html.twig
    @@ -16,5 +16,7 @@
       {% elseif status is constant('MARK_UPDATED') %}
    ...
    +  {% elseif status is constant('MARK_READ') %}
    

    Let's replace constants as well here

  • πŸ‡¬πŸ‡§United Kingdom catch

    I'm still not convinced that this is applicable at all, see for example https://developer.mozilla.org/en-US/docs/Web/HTML/Element/mark

  • πŸ‡¬πŸ‡§United Kingdom catch
Production build 0.69.0 2024