<legend id='F24oj'><style id='F24oj'><dir id='F24oj'><q id='F24oj'></q></dir></style></legend>

      <i id='F24oj'><tr id='F24oj'><dt id='F24oj'><q id='F24oj'><span id='F24oj'><b id='F24oj'><form id='F24oj'><ins id='F24oj'></ins><ul id='F24oj'></ul><sub id='F24oj'></sub></form><legend id='F24oj'></legend><bdo id='F24oj'><pre id='F24oj'><center id='F24oj'></center></pre></bdo></b><th id='F24oj'></th></span></q></dt></tr></i><div id='F24oj'><tfoot id='F24oj'></tfoot><dl id='F24oj'><fieldset id='F24oj'></fieldset></dl></div>
    1. <tfoot id='F24oj'></tfoot>
    2. <small id='F24oj'></small><noframes id='F24oj'>

        <bdo id='F24oj'></bdo><ul id='F24oj'></ul>
    3. 希腊语和文本转换:大写

      时间:2023-08-01
        • <tfoot id='2P1DG'></tfoot>

          <legend id='2P1DG'><style id='2P1DG'><dir id='2P1DG'><q id='2P1DG'></q></dir></style></legend>
            <i id='2P1DG'><tr id='2P1DG'><dt id='2P1DG'><q id='2P1DG'><span id='2P1DG'><b id='2P1DG'><form id='2P1DG'><ins id='2P1DG'></ins><ul id='2P1DG'></ul><sub id='2P1DG'></sub></form><legend id='2P1DG'></legend><bdo id='2P1DG'><pre id='2P1DG'><center id='2P1DG'></center></pre></bdo></b><th id='2P1DG'></th></span></q></dt></tr></i><div id='2P1DG'><tfoot id='2P1DG'></tfoot><dl id='2P1DG'><fieldset id='2P1DG'></fieldset></dl></div>

            <small id='2P1DG'></small><noframes id='2P1DG'>

              <tbody id='2P1DG'></tbody>
              <bdo id='2P1DG'></bdo><ul id='2P1DG'></ul>
              1. 本文介绍了希腊语和文本转换:大写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我编写了一个 Web 应用程序,其中包含多种语言的翻译(其中一种是希腊语.)

                I've written a web application that contains translations in several languages (one of them being Greek.)

                当在标题上显示某个翻译时,设计规则是文本应该是大写的,这在世界上任何其他语言中都可以,但是当涉及到希腊语时,浏览器不知道要写什么处理重音符号(参见 this)所以他们显示错误的大写字符串.

                When displaying a certain translation on the title, the design rule was that the text is supposed to be uppercased, which in any other language in the world is fine, but when it comes to Greek, browsers don't know what to do with the accents (see this) so they display the wrong uppercased String.

                从我上面链接的那个补丁中,我已经将它转换为 Javascript,针对它运行了一些用例,并且它可以工作.现在我要做的就是:

                From that patch I've linked above, I've transformed it to Javascript, ran some use cases against it, and it works. Now all I have to do is this:

                如果不对每个需要大写的元素(有很多)添加 uppercase 类,我可以使用计算的样式属性查询 DOM 吗?IE.给我所有具有计算 text-transform: uppercase

                Without adding a uppercase class to every element that needs to be uppercased (there are quite a few), can I query the DOM using a computed style property? Ie. give me all the elements that have a computed text-transform: uppercase

                推荐答案

                我强烈建议不要为此使用 jQuery.而是这样做:

                I strongly suggest not using jQuery for this. Instead do this:

                var e = document.getElementsByTagName('*'), l = e.length, i;
                if( typeof getComputedStyle == "undefined")
                    getComputedStyle = function(e) {return e.currentStyle;};
                for( i=0; i<l; i++) {
                    if( getComputedStyle(e[i]).textTransform == "uppercase") {
                        // do stuff with e[i] here.
                    }
                }
                

                使用 10,000 个元素进行测试,其中 2,500 个具有大写"文本转换.

                Tested with 10,000 elements, of which 2,500 had "uppercase" text-transform.

                jQuery 处理时间为 595 毫秒
                JS 处理时间为 60ms

                jQuery processed in 595ms
                JS processed in 60ms

                所以 JavaScript 在这方面比 jQuery 快大约 10 倍.

                So JavaScript is approximately 10 times faster at this than jQuery.

                另一个测试,这次有 100,000 个元素:

                Another test, this time with 100,000 elements:

                jQuery failed.TypeError: 对象不支持属性或方法'each'
                JS 处理时间为 577ms

                jQuery failed.TypeError: Object doesn't support property or method 'each'
                JS processed in 577ms

                这篇关于希腊语和文本转换:大写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:Date.toLocaleString() 的 Chrome 时区选项 下一篇:jQuery UI datepicker >= 1.11.0 的 i18n 文件在哪里

                相关文章

              2. <tfoot id='JZ5lj'></tfoot>

                <small id='JZ5lj'></small><noframes id='JZ5lj'>

                <legend id='JZ5lj'><style id='JZ5lj'><dir id='JZ5lj'><q id='JZ5lj'></q></dir></style></legend>
                <i id='JZ5lj'><tr id='JZ5lj'><dt id='JZ5lj'><q id='JZ5lj'><span id='JZ5lj'><b id='JZ5lj'><form id='JZ5lj'><ins id='JZ5lj'></ins><ul id='JZ5lj'></ul><sub id='JZ5lj'></sub></form><legend id='JZ5lj'></legend><bdo id='JZ5lj'><pre id='JZ5lj'><center id='JZ5lj'></center></pre></bdo></b><th id='JZ5lj'></th></span></q></dt></tr></i><div id='JZ5lj'><tfoot id='JZ5lj'></tfoot><dl id='JZ5lj'><fieldset id='JZ5lj'></fieldset></dl></div>

                • <bdo id='JZ5lj'></bdo><ul id='JZ5lj'></ul>