Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Google encode the CSS classes and ID?

Look at the name of the classes in the html block. They have been encoded to make it hard to understand.

<div id=":21r" class="ii gt m14b0b8af41495ba9 adP adO">
    <div id=":21o" class="a3s" style="overflow: hidden;">
        <div dir="ltr">
            <div class="adL"></div>
        </div>
    </div>
</div>

I don't think Google engineers are so jobless to encode classes like these manually. They must have used some tools for encoding the classes. Is there any service available for doing this?

like image 435
Vishnu Ks Avatar asked Jan 21 '15 10:01

Vishnu Ks


People also ask

How do I code a class in CSS?

To select elements with a specific class, write a period (.) character, followed by the name of the class. You can also specify that only specific HTML elements should be affected by a class.

Can ID and class have same name in CSS?

Yes, you can use same name for both id and class because both parameters have their own significance.

Should I use ID or class CSS?

You should use a class if you need to use the same selector more than once within a page or a site. While an ID is specific to a single element, classes can be assigned to multiple elements on a page or throughout the website.


1 Answers

It is very possible that what you are looking at was built in Google Web Toolkit. This environment has automatic Obfuscation depending on what you are looking to release into the world, and is the main environment used by Google when creating web applications.

The process is to write your files normally with your own class and id names, and when you compile the code is automatically obfuscated (or you run it through a compressor or program to do so).

In GWT you have to write in Java, but if you are looking for options for javascript or html/css then:

http://ajaxian.com/archives/utility-javascript-obfuscator https://code.google.com/p/minify/

like image 192
RoboYak Avatar answered Sep 23 '22 01:09

RoboYak