An efficient method of semantic front-end selection

A selector and semantic technology, applied in programming languages/paradigms, creating/generating source code, etc., can solve problems such as the difficulty of development collaboration and rising communication costs, reduce team connection costs, simplify complexity and redundancy, The effect of improving overall efficiency

Inactive Publication Date: 2019-03-22
韩真
5 Cites 0 Cited by

AI-Extracted Technical Summary

Problems solved by technology

Complexity will lead to the difficulty of development collaboration and a ...
View more

Method used

[0171] The present invention designs a method for an efficient semantic front-end selection sub-scheme. In a specific front-end development scenario, the efficient semantic front-end selection sub-scheme uses the S selector as the semantic expression of the component , through html precompilation, css precompilation, and jquery selection rewriting, it can realize large-scale semantics in the entire development range, greatly reduce the complexity and redundancy of html template writing, and greatly reduce the template css writing The degree of coincidence and redundancy greatly simplifies the complexity and redundancy of the code describing the internal operation of the template in jquery; it provides a basis for the generalization of front-end compo...
View more

Abstract

The invention relates to the technical field of programming, in particular to an efficient semantic front-end selection subscheme method. The invention designs an efficient semantic front-end selection sub-scheme method. In a specific front-end development scenario, the S selector is used as the semantic expression of the component, Precompile via html, css Precompilation, jquery chooses to override, It can reduce the complexity and redundancy of html template writing, reduce the coincidence and redundancy of css template writing, and simplify the complexity and redundancy of jquery code describing the internal operation of template to a large extent. Overall, reduce development time, reduce development costs, reduce team docking costs, enhance team combat effectiveness, improve the overall efficiency of development enterprises.

Application Domain

Programming languages/paradigms

Technology Topic

Computer programmingCoincidence +3

Examples

  • Experimental program(1)

Example Embodiment

[0016] Specific embodiment, an efficient method for semantic front-end selection sub-scheme
[0017] 1. Propose the concept of S Selector. The Chinese name is S selector, or subordinate selector.
[0018] 2. An example of an html fragment and related css fragments, jquery fragments are as follows:
[0019] The example writes a very simple login component named login_box.
[0020] The following is the traditional way of writing.
[0021] code html
[0022]
[0023]
[0024]
[0025]
[0026]
[0027] Login
[0028] Register
[0029]
[0030] code css
[0031] login_box {
[0032] border: 1px solid grey;
[0033] padding: 10px;
[0034] }
[0035] login_box .lgbox-rectangle {
[0036] border: 1px solid blue;
[0037] padding: 10px;
[0038] }
[0039] login_box .lgbox-rectangle .lgbox-username {
[0040] width: 100%;
[0041] }
[0042] login_box .lgbox-rectangle .lgbox-username:focus {
[0043] color: blue;
[0044] }
[0045] login_box .lgbox-rectangle .lgbox-password {
[0046] width: 100%;
[0047] }
[0048] login_box .lgbox-rectangle .lgbox- password:focus {
[0049] color: blue;
[0050] }
[0051] login_box .lgbox-login {
[0052] width: 100%;
[0053] }
[0054] login_box .lgbox-register {
[0055] width: 100%;
[0056] }
[0057] code jquery
[0058] var bind_login = function(){
[0059] var self = $(‘login_box’);
[0060] var ball = {};
[0061] self.find(‘.lgbox-rectangle .lgbox-username’).bind(‘input’, function(){ball.username = $(this).val(); })
[0062] self.find(‘.lgbox-rectangle .lgbox-password’).bind(‘input’, function(){ball. password = $(this).val(); })
[0063] self.find(‘.lgbox-login’).click(function(){ do_login(ball); });
[0064] self.find(‘.lgbox-register’).click(function(){ goto_register(); });
[0065] };
[0066] B: The following is the wording using the s selector.
[0067] code html
[0068]
[0069]
[0070]
[0071]
[0072]
[0073] Login
[0074] Register
[0075]
[0076] code css
[0077] login_box {
[0078] border: 1px solid grey;
[0079] padding: 10px;
[0080] }
[0081] login_box ‘rectangle’ {
[0082] border: 1px solid blue;
[0083] padding: 10px;
[0084] }
[0085] login_box ‘rectangle/username’ {
[0086] width: 100%;
[0087] }
[0088] login_box ‘rectangle/username’:focus {
[0089] color: blue;
[0090] }
[0091] login_box ‘rectangle/password’ {
[0092] width: 100%;
[0093] }
[0094] login_box ‘rectangle/password’:focus {
[0095] color: blue;
[0096] }
[0097] login_box ‘login’{
[0098] width: 100%;
[0099] }
[0100] login_box ‘register’{
[0101] width: 100%;
[0102] }
[0103] code jquery
[0104] var bind_login = function(){
[0105] var self = $(‘login_box’);
[0106] var ball = {};
[0107] self.s(‘rectangle/username’).bind(‘input’, function(){ ball.username = $(this).val(); })
[0108] self.s(‘rectangle/password’).bind(‘input’, function(){ ball. password =$(this).val(); })
[0109] self.s(‘login’).click(function(){ do_login(ball); });
[0110] self.s(‘register’).click(function(){ goto_register(); });
[0111] };
[0112] C. You can see:
[0113] 1. In wording B, the selector is more concise and semantic. Help developers better grasp the semantic function of the component. Incidentally, the total number of characters has dropped from 115 to 106. This will become very obvious in the large-scale front-end engineering code base.
[0114] 2. The html expression is more concise, reduces redundancy, and makes the layout of the component itself clearer.
[0115] 3. The expression of css is more concise, reducing redundancy, and visually clearer.
[0116] 4. The expression of jquery code is more concise, reducing redundancy and making the logic clearer.
[0117] 5. At the same time, it can be noted that in the new selector, the S selector can be arranged in any combination with the original selector to form a more complex selector.
[0118] 6. The S selector itself can also be hierarchical. For example, the expression "rectangle/username".
[0119] achieve:
[0120] 1. html tag implementation
[0121] Direct processing
[0122] such as
[0123]
[0124] 1. Write the sname directly into the html tag as an attribute. sname is followed by the name you want to name semantically.
[0125] 2. Pay attention to a html component, such as this time Inside, each sname should not be repeated.
[0126] 3. However, the sname can be repeated within different components, because each component may have a similar internal semantic structure that needs to be expressed. This greatly improves the flexibility of expression.
[0127] Label implementation
[0128] such as:
[0129] A ‘some_name_1/some_name_2’ B{
[0130] some-property: some-value;
[0131] }
[0132] Interpreted as A [sname=’some_name_1’] [sname=’some_name_2’] B {
[0133] some-property: some-value;
[0134] }
[0135] 1. Read the css text into the preprocessor. Divide all css content into an array arr of key-value pairs of "path path: set content content".
[0136] 2. For each key-value pair item in the array arr,
[0137] 3. Perform the PathRewrite(path) operation on the path to get the new path path2. Rewrite item as "new path path2: set content content".
[0138] 4. For each key-value pair item in the array arr
[0139] 5. Rewrite the item into the text as part of the css text.
[0140] 6. Output the new css text.
[0141] Select sub-function implementation
[0142] 3.1 Rewrite jquery selection sub-function implementation
[0143] $("A ‘some_name_1/some_name_2’ B")
[0144] Interpreted as $("A [sname=’some_name_1’] [sname=’some_name_2’] B")
[0145] Perform the PathRewrite(path) operation on the path.
[0146] 3.2 Rewrite the find function on the jquery object.
[0147] $element.find("A ‘some_name_1/some_name_2’ B")
[0148] Interpreted as $element.find("A [sname=’some_name_1’] [sname=’some_name_2’] B")
[0149] Perform the PathRewrite(path) operation on the path.
[0150] 3.3 Added the s function on the jquery object.
[0151] $element.s( "some_name_1/some_name_2")
[0152] Interpreted as $element.find("[sname=’some_name_1’] [sname=’some_name_2’]")
[0153] Added the s function to the jquery object.
[0154] $.fn.s = function(path){
[0155] return $(this).find(PathRewrite(path));
[0156] };
[0157] Perform the PathRewrite(path) operation on the path.
[0158] 4. Algorithm: Select sub-rewrite PathRewrite(path) input:
[0159] 1. Select the subpath path
[0160] Preparation parameters:
[0161] 2. Subpath array arr
[0162] 3. Output subpath array arr2
[0163] 4. Output subpath path2
[0164] Step: 5. Parse path into an array arr according to the grammatical rules. Note that (1) The selectors such as "some_name_1/some_name_2" that have spaces on both sides and other parts need to be parsed out and placed into a single item in the array. (2) It is necessary to not parse the double-quoted string in the syntax of the selector itself such as [some_attr_name=”some_attr_value”] into a single item of the array.
[0165] 6. For each item in the array arr, if it is not a sname, that is, it is not a string enclosed in double quotes, directly put it into the output subpath array arr2; otherwise:
[0166] 7. Divide item from ‘/’ into a new array arr_item. (If there is no ‘/’, it will become an array arr2 with only one object)
[0167] 8. Rewrite each item2 of arr_item as item3 = "[sname=" + item2 +]", and put item3 into the output subpath array arr2.
[0168] 9. After all the above iterations are completed, the output sub-path array arr2 is combined into path2 string using join(‘ ‘).
[0169] Output:
[0170] 10. Output the subpath path2.
[0171] The present invention designs an efficient method of semantic front-end selection sub-scheme. This efficient method of semantic front-end selection sub-scheme adopts S selector as the semantic expression of the component in a specific front-end development scenario, through html Pre-compilation, css pre-compilation, and jquery optional rewriting can realize large-scale semantics of the entire development range, greatly reduce the complexity and redundancy of html template writing, and greatly reduce the overlap and degree of template css writing Redundancy, to a large extent, simplify the complexity and redundancy of the code that jquery describes the internal operations of the template; it provides a foundation for the generalization of front-end components, cross-project reuse, and semantic invocation. This is because the use of the S selector basically solves the problem of ambiguity in the internal elements of the template code. When the number of components reaches tens to hundreds, this problem becomes a problem that has to be paid attention to. Complexity will lead to a significant increase in the difficulty of development collaboration and the cost of internal team communication. At this time, handling the naming problem clearly and constructing semantic naming is the problem we solve; overall, reducing development time, reducing development costs, reducing team docking costs, improving team combat effectiveness, and improving overall efficiency of the development enterprise.

PUM

no PUM

Description & Claims & Application Information

We can also present the details of the Description, Claims and Application information to help users get a comprehensive understanding of the technical details of the patent, such as background art, summary of invention, brief description of drawings, description of embodiments, and other original content. On the other hand, users can also determine the specific scope of protection of the technology through the list of claims; as well as understand the changes in the life cycle of the technology with the presentation of the patent timeline. Login to view more.

Similar technology patents

User behavior data processing method and device, electronic equipment and readable medium

PendingCN111046237Ashorten development timeSolve large data volume graph calculation
Owner:JINGDONG TECH HLDG CO LTD

Test system software universal framework

Owner:BEIJING AEROSPACE MEASUREMENT & CONTROL TECH

Disease-resistant corn seed treatment method

InactiveCN107950113APromote rapid developmentshorten development time
Owner:徐州沐阳生物科技发展有限公司

Advertisement pushing method, apparatus and system

InactiveCN108596670AReduce Redundancy and Complexity
Owner:XIAN WANXIANG ELECTRONICS TECH CO LTD

Dynamic insulation test method and system for fast mechanical switch

InactiveCN109696622ASpeed ​​up R&D progressshorten development time
Owner:PINGGAO GRP +5

Classification and recommendation of technical efficacy words

  • Reduce Redundancy and Complexity

Advertisement pushing method, apparatus and system

InactiveCN108596670AReduce Redundancy and Complexity
Owner:XIAN WANXIANG ELECTRONICS TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products