CN105868404A - Method and device of automatically detecting CSS expression - Google Patents

Method and device of automatically detecting CSS expression Download PDF

Info

Publication number
CN105868404A
CN105868404A CN201610250072.0A CN201610250072A CN105868404A CN 105868404 A CN105868404 A CN 105868404A CN 201610250072 A CN201610250072 A CN 201610250072A CN 105868404 A CN105868404 A CN 105868404A
Authority
CN
China
Prior art keywords
expression formula
css
source code
identifier
css expression
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201610250072.0A
Other languages
Chinese (zh)
Inventor
黄金钰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Feixun Data Communication Technology Co Ltd
Original Assignee
Shanghai Feixun Data Communication Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Feixun Data Communication Technology Co Ltd filed Critical Shanghai Feixun Data Communication Technology Co Ltd
Priority to CN201610250072.0A priority Critical patent/CN105868404A/en
Publication of CN105868404A publication Critical patent/CN105868404A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/83Querying
    • G06F16/835Query processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)
  • Stored Programmes (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a method and a device of automatically detecting CSS expression. The method includes: acquiring an HTML (hypertext markup language) file containing a source code of a user interface; detecting whether the source code in the HTML file contains an identifier of the CSS expression on the basis of preset language or not; if the identifier is detected, determining that the source code contains the CSS expression, and if not, determining that the source code does not contain the CSS expression. Through the above mode, whether the source code contains the CSS expression or not can be detected automatically, and convenience, quickness and accurate result are realized.

Description

A kind of method and device of automatic detection CSS expression formula
Technical field
The present invention relates to Internet technical field, especially relate to a kind of detection CSS expression formula automatically Method and device.
Background technology
CSS (Cascading Style Sheets, CSS) is a kind of for showing HTML (application of standard generalized markup language) or XML (of standard generalized markup language Subset) etc. the computer language of file pattern.
Layout, font, color, background and other effect of the page can be realized by CSS effectively More it is accurately controlled, makes the page become more beautiful, it is easier to layout, make the page really appreciate the heart and please Mesh, to one good visual effect of client, CSS expression formula is then that a kind of use is dynamically arranged The mode of CSS attribute, so can be the most powerful in terms of the pseudo-class of interlacing colour changing or simulation.
But CSS expression formula is often by double counting.It it is not only page rendering and adjusted size of Time, it being scrolled at the page, even user can recalculate expression during mobile mouse on the page Formula.Add an enumerator to CSS expression formula and just can follow the trail of time and the frequency that it recalculates Rate, and dynamic dynamic mouse just can cause more than 10000 time and recalculates on the page.This will affect whole The performance of the individual page, drags slow webpage loading velocity that the page even can be caused stuck.
Therefore, it will usually check and whether the page exists CSS expression formula, in prior art, check Whether interface exists CSS expression formula be typically all by manually checking source code, from first to last examine Check whether to comprise expression formula, if size of code is big, time-consuming laborious again, and be easy to there is leakage Look into.
Summary of the invention
The technical problem that present invention mainly solves is to provide the side of a kind of automatic detection CSS expression formula Method and device, it is possible to automatically detect and in source code, whether comprise CSS expression formula, convenient and swift, And result is accurate.
For solving above-mentioned technical problem, the technical scheme that the present invention uses is: provide one certainly The method of dynamic detection CSS expression formula, the method includes: acquisition comprises the source code of user interface Html file;Whether CSS is comprised based on the source code in default language detection html file The identifier of expression formula;If identifier being detected, it is determined that contain CSS expression formula for source code package, Otherwise it is defined as source code and does not include CSS expression formula.
Wherein, also wrap before the step of the html file obtaining the source code comprising user interface Include: the address information of storage user interface.
Wherein, the identifier of CSS expression formula is expression () expression formula.
Wherein, method also includes: when determining that source code package contains CSS expression formula, returns CSS The position at expression formula place, and provide amendment form.
Wherein, amendment form is CSS expression formula to be deleted, and is replaced by jquery expression formula.
For solving above-mentioned technical problem, another technical solution used in the present invention is: provide one Automatically detecting the device of CSS expression formula, this device includes: Transmit-Receive Unit, comprises use for acquisition The html file of the source code at interface, family;Detector unit, for based on default language detection Whether the source code in html file comprises the identifier of CSS expression formula;Processing unit, is used for When detector unit detects identifier, it is defined as source code package and contains CSS expression formula, the most really It is set to source code and does not include CSS expression formula.
Wherein, device also includes: memory element, for storing the address information of user interface.
Wherein, the identifier of CSS expression formula is expression () expression formula.
Wherein, processing unit, also when determining that source code package contains CSS expression formula, returns CSS The position at expression formula place, and provide amendment form.
Wherein, amendment form is CSS expression formula to be deleted, and is replaced by jquery expression formula.
The invention has the beneficial effects as follows: be different from the situation of prior art, the present invention provides one certainly The method and device of dynamic detection CSS expression formula.The method includes: obtain the source comprising user interface The html file of code;Whether the source code in html file is detected based on default language Comprise the identifier of CSS expression formula;If identifier being detected, it is determined that contain for source code package CSS expression formula, is otherwise defined as source code and does not include CSS expression formula.Therefore, energy of the present invention Enough automatically detect whether source code comprises CSS expression formula, convenient and swift, and result is accurate.
Accompanying drawing explanation
Fig. 1 is the flow process of the method for a kind of automatic detection CSS expression formula that the embodiment of the present invention provides Figure;
Fig. 2 is the structure of the device of a kind of automatic detection CSS expression formula that the embodiment of the present invention provides Schematic diagram.
Detailed description of the invention
Referring to Fig. 1, Fig. 1 is a kind of detection CSS expression formula automatically that the embodiment of the present invention provides The flow chart of method.As it is shown in figure 1, the method for the embodiment of the present invention comprises the following steps:
Step S1: obtain the html file of the source code comprising user interface.
Before this step, also include the address information storing user interface.Specifically, pass through Java The address of user interface is loaded in internal memory and stores by language.
This step, specifically, obtain the source code of user interface, then parses html file.
Step S2: whether comprise CSS based on the source code in default language detection html file The identifier of expression formula.
In this step, if identifier being detected, then jump to step S3, otherwise jump to step S4。
Owing to CSS expression formula can be inserted the code of javascript (js), therefore, this step Preset language be preferably java language.
Wherein, the identifier of CSS expression formula is expression () expression formula.Such as, one allows In body (main body), color (color) every CSS expression formula of a conversion in hour is:
Body{color:expression ((new Date ()) .getHours () %2?”#B8D4FF”
:”#F08A00”);}.
Therefore whether this step detects the source code in html file specifically by java language Comprise expression () expression formula.
Step S3: be defined as source code package and contain CSS expression formula.
This step farther includes, and returns to the position at CSS expression formula place, specifically by dialogue Box form returns the line number at CSS expression formula place, and provides amendment form.Wherein, amendment form For CSS expression formula being deleted, and it is replaced by jquery expression formula.
This step points out user to confirm amendment the most further, and after user determines amendment, according to repairing Change form to modify.Will originally CSS expression formula delete, at < script Type=" text/javascript " > beginning jquery realizes original CSS expression formula.
Accept example above, be revised as:
Step S4: be defined as source code and do not include CSS expression formula.Be given further and point out this Interface does not exist CSS expression formula.
Therefore, the present invention can detect in source code whether comprise CSS expression formula automatically, convenient Fast, and result is accurate.Further, the row at place is returned when including CSS expression formula Number, and modify, therefore can optimize html file, thus improve interface performance.
Automatically the method detecting CSS expression formula of the present invention, is also applied for non-technical personnel and uses, Due to non-technical personnel the product wishing oneself is bright and colourful liked by client while also be intended to The performance of product is good, but whether product exists CSS expression formula and all do not know, therefore, and the present invention The method of automatically detection CSS expression formula user can be made not bright by the knowledge of technical elements Really see oneself product the need of optimization, to safeguarding that oneself internet product is easier to, more directly See.
The present invention also provides for the device of a kind of automatic detection CSS expression formula, it is adaptable to previously described Method.Specifically refer to Fig. 2, as in figure 2 it is shown, the device 20 of the present embodiment includes Transmit-Receive Unit 21, processing unit 22 and detector unit 23.
Wherein, Transmit-Receive Unit 21 is for obtaining the html file of the source code comprising user interface. Specifically, obtain the source code of user interface, then parse html file.
Detector unit 23 is used for based on whether default language detects the source code in html file Comprise the identifier of CSS expression formula.
Owing to CSS expression formula can be inserted the code of javascript (js), therefore, preset Language is preferably java language.
Wherein, the identifier of CSS expression formula is expression () expression formula.Such as, one allows In body (main body), color (color) every CSS expression formula of a conversion in hour is:
Body{color:expression ((new Date ()) .getHours () %2?”#B8D4FF”
:”#F08A00”);}.
Therefore detector unit 23 is specifically by the source code in java language detection html file Whether comprise expression () expression formula.
Processing unit 22, for when detector unit 23 detects identifier, is defined as source code package Containing CSS expression formula, otherwise it is defined as source code and does not include CSS expression formula.
Processing unit 22, also when determining that source code package contains CSS expression formula, returns CSS and expresses The position at formula place, returns the line number at CSS expression formula place specifically by dialog box form, and Provide amendment form.Wherein, amendment form is CSS expression formula to be deleted, and is replaced by jquery Expression formula.
Processing unit 22 prompting user the most further confirms amendment, and after user determines amendment, Modify according to amendment form.Will originally CSS expression formula delete, at < script Type=" text/javascript " > beginning jquery realizes original CSS expression formula.
Accept example above, be revised as:
Processing unit 22 does not include CSS expression formula being defined as source code.Be given further and carry Show and this interface does not exist CSS expression formula.
Further, the device 20 of the present embodiment also includes memory element 24, is used for storing user The address information at interface, memory element 24 can be internal memory.Specifically, processing unit 22 passes through The address of user interface is loaded in internal memory and stores by Java language.
Therefore, the present invention can detect in source code whether comprise CSS expression formula automatically, convenient Fast, and result is accurate.Further, the row at place is returned when including CSS expression formula Number, and modify, therefore can optimize html file, thus improve interface performance.
The foregoing is only embodiments of the invention, not thereby limit the scope of the claims of the present invention, Every equivalent structure utilizing description of the invention and accompanying drawing content to be made or equivalence flow process conversion, or Directly or indirectly being used in other relevant technical fields, the patent being the most in like manner included in the present invention is protected In the range of protecting.

Claims (10)

1. the method for an automatic detection CSS expression formula, it is characterised in that described method includes:
Obtain the html file of the source code comprising user interface;
Whether the source code detected in described html file based on default language comprises CSS table Reach the identifier of formula;
If described identifier being detected, it is determined that contain described CSS for described source code package and express Formula, is otherwise defined as described source code and does not include described CSS expression formula.
Method the most according to claim 1, it is characterised in that described acquisition comprises user circle Also include before the step of the html file of the source code in face:
Store the address information of described user interface.
Method the most according to claim 2, it is characterised in that described CSS expression formula Identifier is expression () expression formula.
Method the most according to claim 1, it is characterised in that described method also includes:
When determining that described source code package contains described CSS expression formula, return described CSS and express The position at formula place, and provide amendment form.
Method the most according to claim 4, it is characterised in that described amendment form is for by institute State CSS expression formula to delete, and be replaced by jquery expression formula.
6. the device of an automatic detection CSS expression formula, it is characterised in that described device includes:
Transmit-Receive Unit, for obtaining the html file of the source code comprising user interface;
Detector unit, for the source code detected in described html file based on default language be The no identifier comprising CSS expression formula;
Processing unit, for when described detector unit detects described identifier, is defined as described Source code package contains described CSS expression formula, is otherwise defined as described source code and does not include described CSS expression formula.
Device the most according to claim 6, it is characterised in that described device also includes:
Memory element, for storing the address information of described user interface.
Device the most according to claim 6, it is characterised in that described CSS expression formula Identifier is expression () expression formula.
Device the most according to claim 6, it is characterised in that described processing unit is also really When fixed described source code package contains described CSS expression formula, return to described CSS expression formula place Position, and provide amendment form.
Device the most according to claim 9, it is characterised in that described amendment form is will Described CSS expression formula is deleted, and is replaced by jquery expression formula.
CN201610250072.0A 2016-04-20 2016-04-20 Method and device of automatically detecting CSS expression Pending CN105868404A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610250072.0A CN105868404A (en) 2016-04-20 2016-04-20 Method and device of automatically detecting CSS expression

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610250072.0A CN105868404A (en) 2016-04-20 2016-04-20 Method and device of automatically detecting CSS expression

Publications (1)

Publication Number Publication Date
CN105868404A true CN105868404A (en) 2016-08-17

Family

ID=56632760

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610250072.0A Pending CN105868404A (en) 2016-04-20 2016-04-20 Method and device of automatically detecting CSS expression

Country Status (1)

Country Link
CN (1) CN105868404A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106874193A (en) * 2017-01-09 2017-06-20 深圳市赛亿科技开发有限公司 A kind of method and system of detection flex layout attributes integralities

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060200499A1 (en) * 2005-03-07 2006-09-07 Computer Associates Think, Inc. System and method for data manipulation
CN103023874A (en) * 2012-11-21 2013-04-03 北京航空航天大学 Phishing website detection method
CN103809940A (en) * 2012-11-07 2014-05-21 江苏仕德伟网络科技股份有限公司 Method for judging div+css structure

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060200499A1 (en) * 2005-03-07 2006-09-07 Computer Associates Think, Inc. System and method for data manipulation
CN103809940A (en) * 2012-11-07 2014-05-21 江苏仕德伟网络科技股份有限公司 Method for judging div+css structure
CN103023874A (en) * 2012-11-21 2013-04-03 北京航空航天大学 Phishing website detection method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
陈俊璘: "Web应用程序的性能优化研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *
陈希章: "优化网站涉及七:避免在CSS中使用表达式", 《HTTP://WWW.CNBLOGS.COM/CHENXIZHANG/ARCHIVE/2013/05/01/3053439.HTML》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106874193A (en) * 2017-01-09 2017-06-20 深圳市赛亿科技开发有限公司 A kind of method and system of detection flex layout attributes integralities

Similar Documents

Publication Publication Date Title
US9367535B2 (en) Dashboard formula execution
US20140149836A1 (en) Dashboard Visualizations Using Web Technologies
CN107729475B (en) Webpage element acquisition method, device, terminal and computer-readable storage medium
US20180052809A1 (en) Inferring user interaction with an iframe
US20080155397A1 (en) Synchronizing data between different editor views
US20140149839A1 (en) Asynchronous Dashboard Query Prompting
US9317622B1 (en) Methods and systems for fragmenting and recombining content structured language data content to reduce latency of processing and rendering operations
US10642924B2 (en) Advertisement filtering method and device
US8413070B1 (en) Declarative resizeable list in electronic form
WO2020118485A1 (en) Method of Detecting User Interface Layout Issues for Web Applications
CN105868096B (en) For showing the method, device and equipment of web page test result in a browser
CN104077387A (en) Webpage content display method and browser device
CN103678511B (en) The method and device of webpage content extraction is carried out according to visual template
CN106354483B (en) Data processing method and device and electronic equipment
CN103488732A (en) Generation method and device of static pages
IL226027A (en) Bidirectional text checker and method
US9715483B2 (en) User interface for testing and asserting UI elements with natural language instructions
US9294538B1 (en) Dynamic content injection
TW201804340A (en) Method and device for generating script
CN105447198A (en) Convenient page script importing method and device
US20150020045A1 (en) Method, device and computer-readable storage medium for closure testing
CN106033387B (en) The method and apparatus for testing flash intrinsic controls
US10282398B1 (en) Editing tool for domain-specific objects with reference variables corresponding to preceding pages
WO2016057510A1 (en) Generating mobile web browser views for applications
CN105868404A (en) Method and device of automatically detecting CSS expression

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20160817

WD01 Invention patent application deemed withdrawn after publication