It seems that Firefox is ignoring the word-wrap style when the class of a child element is changed

Take a look at this:

var iconIndex = 0;
  var icons = ['check', 'chain-broken', 'flag-o', 'ban', 'bell-o'];

  $('button:eq(0)').click(function() {
    iconIndex = (iconIndex + 1) % icons.length;
    $('#dev-0 .status-icon').attr('class', 'status-icon fa fa-fw fa-' + icons[iconIndex]);
  });
ul {
  width: 200px;
  border: 1px dotted #ccc;
}
.device-list-item {
  max-height: 31px;
  overflow: hidden;
  word-break: break-all;
}
a {
  position: relative;
  display: block;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/css/tether.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" rel="stylesheet" />

<ul class="nav">
  <li id="dev-0">
    <a href="#" class="device-list-item">
      <span>
        <i class="status-icon fa fa-fw fa-bell-o"></i>
        <span>Firstwordhere Secondwordhere</span>
      </span>
    </a>
  </li>
</ul>

<button>Click me</button>

(Well, it seems that the Snippets feature causes this to happen before the button is clicked. If you want to check it out, you can do so on JSFiddle here)

By clicking the button, the icons should cycle through, but in Firefox only, the "second word" is also removed. It appears that the word wrapping is changing, causing the second word to drop down to an [invisible] second line. Toggling the word-break: break-all property off then back on using the debugger restores the initial state.

What could be the cause of this issue? Is it related to incorrect HTML/styles or a bug in Firefox?

And how can I address this with minimal modifications?

This issue occurs in Firefox versions 50.1.0 and 51.0.1; it works fine in Chrome 55 and IE 11 (all on Windows 7).

Answer №1

I suspect that the issue at hand can be pinpointed to Chrome bug 84345, a problem that is rumored to have been resolved in version 80 (expected release date: March).

Confirming this, I have verified that it functions correctly on Chrome Canary 80.0.3987.0 as of today.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

AngularJS encountered an error: [$injector:modulerr] problem occurred during code execution

Hey there! I've been trying to set up a pop-up feature in Angular, but unfortunately, I keep encountering an error: Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.4.9/$injector/modulerr?p0=PopupDemo&p1=Error%…ogleapis.com%2Fa ...

What is the best way to conduct tests on React components' methods and ensure they are integrated into my Istanbul coverage report

Is there a way to test the methods of react components and include them in my Istanbul test coverage? Edit: I'm using enzyme. Just wanted to mention that. Take, for instance, this component: class SearchFormContainer extends Component { static h ...

Transmitting a pair of parameters in a solitary AJAX call

Currently, I have a webpage that retrieves user input from $_POST. Here is an example of how it looks: $login=$_POST['name']; Later on, upon clicking a button, it triggers an AJAX request as shown below: var id = $(this).val(); var d ...

Change elements in real-time

I have a requirement to adjust elements with the class .super-elem by adding an attribute adjusted="true". Initially, I can easily achieve this within the document's ready event : $(".super-elem").attr("adjusted", "true"); However, I may add more . ...

A complete guide on utilizing *ngFor in Angular to display data rows

I am facing an issue with using *ngFor to create new "rows" for adding new categories dynamically. Although there are no errors displayed when I run the program, the intended functionality is not achieved. I have tried making some modifications but it see ...

How to parse JSON in JavaScript/jQuery while preserving the original order

Below is a json object that I have. var json1 = {"00" : "00", "15" : "15", "30" : "30", "45" : "45"}; I am trying to populate a select element using the above json in the following way. var selElem = $('<select>', {'name' : nam ...

add a hyperlink within a mouse click action

Looking for a way to make phone numbers clickable on mobile devices? Check out this script! I've implemented a script that displays a phone number when users click 'call us' and sends a Google Analytics event. However, I'm having troub ...

What are some alternative ways to link a local MongoDB database to my Android Studio application instead of using MongoLab?

Can someone please help me figure out how to connect my Android Studio project to a MongoDB database stored locally on my PC? I've been searching for solutions that don't involve using MLab, but I haven't had any luck. I've attempted f ...

Concealing the Footer on Mobile Websites in Muse UI When the Keyboard Appears

In this project, I am using vue.js along with muse.ui and only incorporating JavaScript and CSS without the jQuery library. Currently, the footer position always ends up on top of the keyboard whenever an input field is focused. Is there a way to ensure th ...

Validation of hidden fields in MVC architectureUsing the MVC pattern to

Depending on the selections made in the dropdown menu, certain fields will appear and disappear on the page. For example: <section> @Html.LabelFor(model => model.AuctionTypeId) <div> @Html.DropDownList("AuctionTypeI ...

React.map does not retrieve the specific value

I am facing an issue with my list of items. I have implemented it using mui list, and I have also added a button for editing the list. However, when I click on an item, I am getting the value of the last item instead of the one I clicked on. Below is my f ...

Click on ng-click to sort through the blog entries

Currently, I am in the process of developing a blog utilizing AngularJS and JSON. Nearly everything is functioning as expected except for one particular filter item. As I am relatively new to Angular, it presents a bit of a challenge for me. The issue ari ...

Embedding a YouTube video in a view player using HTML5

So I've got a question: can you actually open a youtube video using an HTML5 video player? I'm looking for a more mobile-friendly way to watch youtube videos, and my idea was to upload a thumbnail image and then set up an onclick function to disp ...

Retrieve the updated text content from a textarea using JavaScript/jQuery

For a beginner in javascript and jquery like me, I encountered an issue with a textarea element that has preset content. When I change the value on the site to "new" and click the "showme" button, the alert box displays the preset value instead of the new ...

Waiting for the forEach loop to complete

One of my express endpoints has a functionality that includes checking the availability of domain names against GoDaddy's API. However, I am struggling with how to properly await the results. My code currently iterates through an array called tlds an ...

Issue with jQuery animation opacity not functioning correctly while simulating toggling using .on() and .off() methods

I have been working on creating a form that should show up when the user clicks a button, and then disappear when the user clicks anywhere outside the form. http://jsfiddle.net/z4gavkfd/ var app = { init: function() { $("#button").on("click", functi ...

The function jQuery.post is transmitting special characters encoded

After creating a string using recipeBlob = JSON.stringify(recipeData), I noticed that when sending it via $.post, the received data at my PHP script is showing up with escaped characters like this: {\"properties\":{\"Energy\":{\"v ...

Alter the background color of a React application with a single click in a spontaneous manner

When I attempted to change the background color of the entire page randomly by clicking a button, it only changed the background of the div element. Here is the code snippet I used: import React from "react"; class Home extends React.Component { ...

What is the proper method to deactivate a hyperlink in Angular 2?

I'm currently developing a web application using Angular2, and I find myself in need of displaying, but making it non-clickable, an <a> element within my HTML. Can anyone guide me on the correct approach to achieve this? Update: Please take no ...

Ensure that the TextBox field extends to the edges of the parent div, with full cross-browser compatibility

In the following code snippet, there is a challenge in ensuring that the TextBox field properly fits within the Width and Height of the div#chat-message. This seems to work well in Chrome but encounters issues in IE8 or Mozilla. Additionally, in Mozilla, t ...