请注意我对这个惟一id采用了一个十分简单的方式(使用了一个简化了的歌曲名称,用下划线代替了空格)。
Notice that I took a very simple approach to the unique ID (using a simplified version of the song name with underscores instead of Spaces).
注意:虽然可以在media属性中使用多个值,但是这些值之间必须以逗号隔开,而不是像rel属性的值那样使用空格作为分隔符。
Beware: while you can use multiple values in the media attribute, they must be separated by commas, as opposed to the Spaces you'd use for values of the rel attribute.
请注意,此方案在循环中使用正则表达式检测字符串尾部的字符是否空格,尽管使用正则表达式增加了一点性能负担,但它允许你根据浏览器定义空格字符列表,以保持简短和兼容性。
Although using a regex for this adds a bit of performance overhead, it lets you defer the list of whitespace characters to the browser for the sake of brevity and compatibility.
应用推荐