久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

console.log() 不輸出 jQuery 選擇對象的 HTML

console.log() not outputting HTML of jQuery selection object(console.log() 不輸出 jQuery 選擇對象的 HTML)
本文介紹了console.log() 不輸出 jQuery 選擇對象的 HTML的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

在 Google Chrome 中使用 console.log 時遇到問題.突然,當我輸出像 $(this) 這樣的元素時,它的顯示如下:

I got a problem when using console.log in Google Chrome. Suddenly when I was outputting a element like $(this) it was display like:

[<div>, context: <div>]

[jQuery.fn.jQuery.init[1]]

在控制臺中.(兩者都來自同一行:console.log($(this)))

in the console. ( Both came from the same row: console.log($(this)) )

這個問題昨天不知從何而來.代碼沒有問題.我在另一臺計算機上記錄了完全相同的內容,并且顯示如下:

This problem arose yesterday from nowhere. There ain't a problem with the code. I logged the exact same thing on an other computer and there it is being displayed like:

[<div class='element'></div>, ...]

更新:新的Chrome版本改變了console.log()

Update: the new Chrome version changes the output of console.log()

有誰知道我如何才能恢復 Google Chrome 控制臺的原始設置?

Does anyone know how I can get back to the original settings of Google Chrome console?

推薦答案

回答問題:

  • 有誰知道我如何才能恢復 Google chrome 控制臺的原始設置?

沒有設置可以獲取之前的 console.log() 輸出.您可以:

There are no settings to get the former output of console.log(). You can either:

  • 降級瀏覽器(使用舊版本的 chrome 或 鉻基替代品)
  • 通過添加您自己的 function log()
  • 覆蓋 console.log()
  • 在某些情況下使用 outerHTML 或升級到 chrome 25.0.1323.1 (dev channel) where console.log($(#Selector)[0]);再次返回 outHMTL(見下文).

根據 user916276,console.log(jQuery-Object) 的輸出發生了變化:

According to user916276 the output of console.log(jQuery-Object) has changed:

// output of console.log($jQuerObject) 
[<div class='element'></div>, ...] // in chrome <= 23
[<div>, context: <div>]            // in chrome 24

用戶 brentonsrine 讓我意識到我的 context.outerHTML 并不總是有效.

User brentonstrine made me aware of the fact that my context.outerHTML does not always work.

我用一個新示例更新了我的代碼.似乎 jqObject.context.outerHTML 的存在取決于您如何將 jQuery-Object 傳遞給函數.我用 chrome dev channel (25.0.1323.1) 和兩個基于鉻的版本對其進行了測試(21, 22).

I updated my code with a new example. It seems that the existence of jqObject.context.outerHTML depends how you pass the jQuery-Object to the function. I tested it with chrome dev channel (25.0.1323.1) and two chromium based versions (21, 22).

console.log($(this)); // old chrome versions 
// new chrome version >23
// if you pass this to the function see my getThis(_this) function
console.log($(this).context.outerHTML); 
// if you use a jQuery selector
console.log($(this)[0]);   // at least in chrome build 25.0.1323.1

為了避免誤解.這個答案是關于將 jQuery 對象寫入 最近的 google chrome 瀏覽器(版本 24、25)的內置控制臺.

To avoid misunderstandings. This answer is about the changed behaviour of writing a jQuery object to the inbuild console of the recent google chrome browsers (version 24, 25).

我查看了 chrome 源代碼更改 在 Console.cpp 和 時間線視圖 了解 WebInspector 的變化.我找不到導致 console.log() 行為變化的確切變化.我認為它與 更改有關到 ConsoleView.js,2,3.如果有人想啟動 console.log() 返回與 Chrome 21、22 中相同的輸出,他可以提交錯誤.這兩個 bugs 可以用作模板來提出更改請求.

I took a look into the chrome source code changes at the Console.cpp and in the timeline view to find out about the changes in the WebInspector. I could not find the exact change that is responsible for the changed behaviour of console.log(). I assume that it has to do with changes to ConsoleView.js, 2, 3. If anyone would like to initiate that console.log() returns the same output as in Chrome 21, 22 he could file a bug. This two bugs could be used as a template to place the change request.

這篇關于console.log() 不輸出 jQuery 選擇對象的 HTML的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to fix BrowserWindow is not a constructor error when creating child window in Electron renderer process(在 Electron 渲染器進程中創建子窗口時如何修復 BrowserWindow 不是構造函數錯誤) - IT屋-程序員軟件開發技術
mainWindow.loadURL(quot;https://localhost:3000/quot;) show white screen on Electron app(mainWindow.loadURL(https://localhost:3000/) 在 Electron 應用程序上顯示白屏)
Electron webContents executeJavaScript : Cannot execute script on second on loadURL(Electron webContents executeJavaScript:無法在第二個 loadURL 上執行腳本)
how to use electron browser window inside components in angular-cli?(如何在angular-cli的組件內使用電子瀏覽器窗口?)
ElectronJS - sharing redux store between windows?(ElectronJS - 在 Windows 之間共享 redux 存儲?)
How to access camera/webcamera inside electron app?(如何在電子應用程序中訪問相機/網絡攝像頭?)
主站蜘蛛池模板: 在线中文字幕国产 | 国产一区免费 | 特黄小视频 | 可以看黄的视频 | 国产精品精品 | 亚洲精品一二三 | 日本一区二区不卡视频 | 日韩午夜电影在线观看 | 成人性视频在线播放 | 欧美精品被 | 精品中文字幕一区 | 国产欧美在线播放 | 91免费版在线观看 | 自拍视频一区二区三区 | 亚洲国产精品人人爽夜夜爽 | 日韩美女爱爱 | 欧美在线视频一区二区 | 亚洲网在线| 日韩精品在线看 | 日日干日日| 视频二区 | 亚洲另类春色偷拍在线观看 | 日韩a在线 | 亚洲精品久久久一区二区三区 | 亚洲一区二区三区 | www国产成人| 成人九色 | 日韩免费一区二区 | 亚洲成人网在线 | 亚洲欧美国产毛片在线 | 欧美 日韩 中文 | 成人精品一区二区 | 一级亚洲| 国产7777 | 久久伊人一区 | 欧美一区二区免费 | 日韩www视频 | 欧美日韩国产一区二区三区 | 正在播放国产精品 | 天天综合网天天综合 | 国产精品国产三级国产aⅴ浪潮 |