oio11: (Default)
2015-12-07 01:27 am
Entry tags:

javascript - What is the purpose of the HTML "no-js" class? - Stack Overflow

javascript - What is the purpose of the HTML "no-js" class?


I notice that in a lot of template engines, in the HTML5 Boilerplate, in various frameworks and in plain php sites there is the no-js class added onto the <HTML> tag.
Why is this done? Is there some sort of default browser behavior that reacts to this class? Why include it always? Does that not render the class itself obsolete, if there is no no-"no-js" case and html can be addressed directly?
Here is an example from the HTML5 Boilerplate index.html:
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]--> <!--[if IE 7 ]>    <html lang="en" class="no-js ie7"> <![endif]--> <!--[if IE 8 ]>    <html lang="en" class="no-js ie8"> <![endif]--> <!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]--> <!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
As you can see, the <html> element will always have this class. Can someone explain why this is done so often?
asked Jul 17 '11 at 14:35
Swader
3,57352870

5 Answers


When Modernizr runs, it removes the "no-js" class and replaces it with "js". This is a way to know in your CSS whether or not Javascript support is enabled.
answered Jul 17 '11 at 14:37
...  The no-js class is used by the Modernizr feature detection library. When Modernizr loads, it replaces no-js with js. If JavaScript is disabled, the class remains. This allows you to write CSS which easily targets either condition.
Remove "no-js" class from element, if it exists: docElement.className=docElement.className.replace(/\bno-js\b/,'') + ' js';
Here is a blog post by Paul Irish describing this approach:http://www.paulirish.com/2009/avoiding-the-fouc-v3/

I like to do this same thing, but without Modernizr. I put the following <script> in the <head>to change the class to js if JavaScript is enabled. I prefer to use .replace("no-js","js") over the regex version because its a bit less cryptic and suits my needs.
<script>     document.documentElement.className =         document.documentElement.className.replace("no-js","js"); </script>
Prior to this technique, I would generally just apply js-dependant styles directly with JavaScript. For example:
$('#someSelector').hide(); $('.otherStuff').css({'color' : 'blue'});
With the no-js trick, this can Now be done with css:
.js #someSelector {display: none;} .otherStuff { color: blue; } .no-js .otherStuff { color: green }
This is preferable because:
  • It loads faster with no FOUC (flash of unstyled content)
  • Separation of concerns, etc...
answered Sep 13 '12 at 16:22
http://stackoverflow.com/questions/6724515/what-is-the-purpose-of-the-html-no-js-class


23 мая 2012 в 04:12

Modernizr: практическое применение 
tutorial recovery mode

Modernizr — это JavaScript-библиотека, которая узнаёт, что из HTML5 и CSS3 умеет браузер пользователя. Определяя возможности браузера, разработчик может сделать откат некоторых функций для старых версий браузеров. Создатели Modernizr называют такую проверку feature detection, и это гораздо эффективнее, чем просто определить браузер, его версию и ОС.

Я был премного удивлён факту отсутствия развёрнутой статьи об этой JS-библиотеке (анонс не в счёт). Статья составлена из перевода официальной документации проекта, переводов нескольких статей и собственных дополнений. ..

http://habrahabr.ru/post/144352/
oio11: (Default)
2015-11-01 09:01 am
Entry tags:

Ubuntu: Как полностью удалить Java

понедельник, 4 ноября 2013 г.

Ubuntu: Как полностью удалить Java

 
Удалить все пакеты Java (Sun, Oracle, OpenJDK, IcedTea plugins, GIJ):
sudo apt-get update apt-cache search java | awk '{print($1)}' | grep -E -e '^(ia32-)?(sun|oracle)-java' -e '^openjdk-' -e '^icedtea' -e '^(default|gcj)-j(re|dk)' -e '^gcj-(.*)-j(re|dk)' -e 'java-common' | xargs sudo apt-get -y remove sudo apt-get -y autoremove 
Очистить конфигурационные файлы:
dpkg -l | grep ^rc | awk '{print($2)}' | xargs sudo apt-get -y purge 
Удалить конфигурационный файл Java и кэш:
sudo bash -c 'ls -d /home/*/.java' | xargs sudo rm -rf 
Удалить виртуальные машины, установленные вручную:
sudo rm -rf /usr/lib/jvm/* 
Удалить все остальное:
for g in ControlPanel java java_vm javaws jcontrol jexec keytool mozilla-javaplugin.so orbd pack200 policytool rmid rmiregistry servertool tnameserv unpack200 appletviewer apt extcheck HtmlConverter idlj jar jarsigner javac javadoc javah javap jconsole jdb jhat jinfo jmap jps jrunscript jsadebugd jstack jstat jstatd native2ascii rmic schemagen serialver wsgen wsimport xjc xulrunner-1.9-javaplugin.so; do sudo update-alternatives --remove-all $g; done 
Поиск оставшихся директорий:
sudo updatedb sudo locate -b '\pack200' 
Если вывод предыдущей команды показал что-то вроде этого: /path/to/jre1.6.0_34/bin/pack200 , удалите родительский директорий bin, как здесь: sudo rm -rf /path/to/jre1.6.0_34.


http://eldoradozpua.blogspot.com/2013/11/ubuntu-java.html
oio11: (Default)
2013-07-12 12:19 pm

How To Install Oracle Java 7 In Debian Via Repository

18 Jun 2012

A quick tip for Debian users who want to install and stay up to date with the latest Oracle Java 7 (JDK7): the WebUpd8 Java 7 PPA works on Debian too since the package is just an installer and all you have to do is manually add the PPA repository to the Software Sources.Read more... )
oio11: (Default)
2013-06-10 01:01 am

Как сменить версию Java в Linux, используемую по умолчанию

среда, 24 апреля 2013 г.


Установка Java в Linux

......проверим не установлена ли SunJava уже,

java -version

... .......сменить версию используемую по умолчанию делаем это так поочередно вводя команды


# update-alternatives --config java  

# update-alternatives --config javaс  

# update-alternatives --config javaws



http://onlyadmin.blogspot.com/2013/04/java-linux.html
oio11: (Default)
2013-04-27 10:16 am

7 вещей, которые стоит сделать после установки Ubuntu 13.04

7 вещей, которые стоит сделать после установки Ubuntu 13.04

http://myubuntu.ru/images/4/ubuntu13.04.png
Стал доступен для загрузки новый релиз Ubuntu 13.04, и так как многие уже установили его, вот 7 полезных вещей, которые вы можете сделать прямо после установки.Read more... )
oio11: (Default)
2013-02-06 02:31 pm

Re: Wheezy and Sun-Java

Re: Wheezy and Sun-Java




> On Fri, 17 Aug 2012, Lou wrote:Read more... )
oio11: (Default)
2013-02-06 09:18 am

Oracle Java (JDK) 6 / 7 / 8 Installer PPA

Oracle Java (JDK) 6 / 7 / 8 Installer PPA

Read more... )
oio11: (Default)
2012-06-14 08:44 pm

Релиз Java SE 7 Update 5

Релиз Java SE 7 Update 5

Read more... )
Автор: Максим Мишутин | 14.06.2012 | 2:14

Oracle сообщила о выпуске корректирующего релиза Java SE 7 Update 5.
В основным была проведена работа по устранению найденных уязвимостей. 3 уязвимости в Deployment Toolkit, по одной в JRE, Hotspot VM, 2D-подсистеме, Swing, одна JAXP, CORBA, библиотеках, сетевой подсистеме и системе обеспечения безопасности.
Чтобы установить Java SE 7 Update 5 в Ubuntu 10.04-12.04 выполните следующие команды:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-jdk7-installer

http://proubuntu.com.ua/2012/06/14/java-se-7-update-5.html