Удаление <связывает> элемент с jQuery?

Если мы используем EF и читаем элемент базы данных в цикле while, то

   using( var idr = connection, SP.......)
   {
       while(idr.read())
       {
          if(String.IsNullOrEmpty(idr["ColumnNameFromDB"].ToString())
          //do something
       }
   }
12
задан Aron Rotteveel 9 June 2009 в 19:08
поделиться

3 ответа

Это не ошибка в jQuery, это ошибка (или, возможно, особенность) механизма рендеринга IE .

Похоже, эта проблема вызвана тем фактом, что Internet Explorer неправильно повторно отображает страницу после удаления элемента LINK из DOM.

В этом конкретном случае тег LINK больше не присутствует в DOM, но IE по-прежнему отображает CSS, загруженный в память.

Обходной путь / решение - отключить таблицу стилей с помощью свойства .disabled следующим образом:

// following code will disable the first stylesheet
// the actual DOM-reference to the element will not be removed; 
// this is particularly useful since this allows you to enable it
// again at a later stage if you'd want to.
document.styleSheets[0].disabled = true;

ИЗМЕНИТЬ в ответ на ваш комментарий:

Или, если вы хотите удалить его, в href используется следующий код:

var styleSheets = document.styleSheets;
var href = 'http://yoursite.com/foo/bar/baz.css';
for (var i = 0; i < styleSheets.length; i++) {
    if (styleSheets[i].href == href) {
        styleSheets[i].disabled = true;
        break;
    }
}
20
ответ дан 2 December 2019 в 04:25
поделиться

Возможно, используя строчные буквы в имени тега?

0
ответ дан 2 December 2019 в 04:25
поделиться

Perhaps it's something strange IE6 does to URL in the href attribute? Try something like:

$("LINK[href*='style.css']").remove();

(i.e. check whether the href value contains "style.css")

It's just a guess, however. If that doesn't work, I recommend checking the JQuery documentation closely on the subject of attribute selectors and the remove method.

Also keep in mind that it's also not impossible that it's in fact a bug. (IE6 in general causes lots of issues involving JavaScript and DOM manipulation, among other things.)

9
ответ дан 2 December 2019 в 04:25
поделиться
Другие вопросы по тегам:

Похожие вопросы: