简体   繁体   English

javascript mime-type中的多余文本(几种公认的js mime类型除外)

[英]extra texts in javascript mime-type (Other than several recognized js mime types)

While inspecting the source code of this website: http://www.flipkart.com/ , I found this line <script type="text/javascript+fk-onload"> . 在检查该网站的源代码: http : //www.flipkart.com/时 ,我发现这行<script type="text/javascript+fk-onload"> I know there are many different mime types for javascript but this one has some added texts that goes over my mind. 我知道javascript有许多不同的mime类型,但是这一类增加了一些我想到的文本。 Could anyone explain the purpose of this extra text and when can it be used? 谁能解释这个额外文本的目的,什么时候可以使用?

The + -suffix defines a subtype. +后缀定义一个子类型。 They are using it to execute that particular script onload : 他们使用它来执行特定的脚本onload

FKART.utils.runOnload = function(a) {
    FKART.utils.runSnippet("fk-onload", a)
};
FKART.utils.runSnippet = function(a, c) {
    c = c || "script[type='text/javascript+" + a + "']";
    $(c).each(function() {
        var d = $(this);
        if (d.attr("data-src")) {
            $script(d.attr("data-src"), b.curry(this))
        }
        else {
            b(this)
        }
    });
    function b(d) {
        FKART.utils.evalScript(d.text || d.textContent || d.innerHTML);
        d.type = d.type + "-executed"
    }
};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM