久久久久久久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?(如何在電子應用程序中訪問相機/網絡攝像頭?)
主站蜘蛛池模板: 久久亚洲精品国产精品紫薇 | 国产精品成人国产乱 | 久久手机视频 | 一级做a爰片久久毛片免费看 | 午夜一级做a爰片久久毛片 精品综合 | 91久久夜色 | 亚洲激情综合 | 殴美成人在线视频 | 天天操天天插 | 亚洲情综合五月天 | 久久av网站| 人和拘一级毛片c | www.久 | 亚洲一区二区三区福利 | 欧美成人免费 | 亚洲一区视频 | 国产精品高清一区二区三区 | 欧美一区2区三区4区公司二百 | 美女一级毛片 | 国产日韩免费视频 | 亚洲性人人天天夜夜摸 | wwwxx在线观看 | 国产精品成人一区二区 | 最新国产精品精品视频 | 伊人av在线播放 | 精品99久久 | 久久艹av| a级在线免费 | 岛国毛片在线观看 | 一区二区三区欧美在线 | 午夜三区| 欧美日韩亚洲视频 | 在线视频成人 | 成年人国产在线观看 | 久久综合av | 亚洲欧洲精品在线 | 国产高清视频一区 | 日日碰狠狠躁久久躁96avv | 天天摸天天干 | 性欧美精品一区二区三区在线播放 | 欧美一区二区三区在线免费观看 |