我如何调试我在background.js中的代码,其中包含我的一些浏览器操作.
代码在选项卡的负载上运行以验证URL
chrome.tabs.onUpdated.addListener(checkForValidUrl);
Run Code Online (Sandbox Code Playgroud)
但是当我检查弹出窗口并尝试调试我的代码时,我在我的文件中找不到background.js.
我该如何调试这个文件?
我需要对一些radio输入进行样式化.我从这里尝试了一些解决方案,但没有一个适合我.有人可以看看这段代码并告诉我我该怎么办?
这是HTML:
<div class="controls">
<table>
<tbody>
<tr>
<td>
<label class="radio">
<input type="radio" name="ad_caroserie" value="0">Berlina
</label>
</td>
<td>
<label class="radio">
<input type="radio" name="ad_caroserie" value="1">Break
</label>
</td>
<td>
<label class="radio">
<input type="radio" name="ad_caroserie" value="2">Cabrio
</label>
</td>
</tr>
</tbody>
</table>
</div>
Run Code Online (Sandbox Code Playgroud)
而CSS:
label.radio {
background: #fcb608;
}
.radio input {
display: none;
}
label.radio input[type="radio"]:checked + label {
background: #000 !important;
border: 1px solid green;
padding: 2px 10px;
}
Run Code Online (Sandbox Code Playgroud)
CSS没有预期的效果; 你能帮我么?
这是JS的一些相关摘录:
//If checkboxes or radio buttons, special treatment
else if …Run Code Online (Sandbox Code Playgroud) 我使用 defaultValue 在 textarea 中传递 this.props.childred 但它给了我错误未捕获错误:如果您defaultValue在 a 上提供,请勿传递子项。
还有什么其他选择或者有更好的方法来确定价值观
import React, {Component} from 'react';
class Update extends Component {
constructor(props){
super(props);
this.state = {
editing:false
}
this.renderEdit = this.renderEdit.bind(this)
}
edit(){
this.setState({
editing:true
})
}
remove(){
alert("remove")
}
save(){
this.setState({
editing:false
})
}
renderNormal(){
return (
<div className="container">
<div className="content"> {this.props.children}</div>
<button onClick={this.edit.bind(this)} className="edit" >Edit </button>
<button onClick={this.remove} className="remove" >Remove </button>
</div>
);
}
renderEdit(){
console.log( 'this.props ', this.props)
console.log( 'this.props.children ', this.props.children)
return (
<div className="container"> …Run Code Online (Sandbox Code Playgroud) 在javascript中,我有一个像这样的HTML块:
<h2>{title}</h2>
<p><a href="{url}">{content}</a></p>
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用正则表达式"匹配"来吐出所有{item}的数组.所以我的输出应该是这样的:
['title', 'url', 'content']
Run Code Online (Sandbox Code Playgroud)
我已经达到了:
var pattern = new RegExp("\{[a-zA-Z]+\}+");
var match = pattern.exec("{Sample} bob {text}");
Run Code Online (Sandbox Code Playgroud)
但它只返回第一个标签.
这超出了我的正则表达能力.有人可以帮忙吗?
干杯!
我刚刚将服务器上的PHP从php 5更新到了php 7,并且收到以下警告:
警告:preg_replace_callback()[function.preg-replace-callback0]:要求参数2'chr(\ 1)'为有效的回调
警告:preg_replace_callback()[function.preg-replace-callback0]:要求参数2'chr(0x \ 1)'为有效的回调
警告:preg_replace_callback()[function.preg-replace-callback0]:要求参数2'chr(\ 1)'为有效的回调
警告:preg_replace_callback()[function.preg-replace-callback0]:要求参数2'chr(0x \ 1)'为有效的回调
这是PHP代码:
private function _decode( $source )
{
$source = html_entity_decode($source, ENT_QUOTES, 'UTF-8');
$source = preg_replace_callback('/&#(\d+);/me',"chr(\\1)", $source);
$source = preg_replace_callback('/&#x([a-f0-9]+);/mei',"chr(0x\\1)", $source);
return $source;
}
Run Code Online (Sandbox Code Playgroud)
警告来自:
$source = preg_replace_callback('/&#x([a-f0-9]+);/mei',"chr(0x\\1)", $source);
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
javascript ×2
arrays ×1
css ×1
html ×1
match ×1
php ×1
radio-button ×1
reactjs ×1
regex ×1
templates ×1